Stream: fhirpath
Topic: Precision for comparison of decimal numbers?
Tilo Christ (Jan 06 2022 at 17:01):
I am covering FHIRPath implementation with tests and in the FHIRPath test suite there is a test which says 1.2 / 1.8 = 0.66666667. Using my implementation I am getting a couple of sixes more. Is there any expectation that = has some sort of built-in tolerance? The fhirpath.js implementation passes this one, but I have searched the specifications on any kind of tolerance rules and haven't found anything so far.
Grahame Grieve (Jan 06 2022 at 18:26):
@Bryn Rhodes
Bryn Rhodes (Jan 06 2022 at 20:40):
We say in the description of the Decimal type that implementations must support at least 8 digits of precision. They can support more, but are not required to. We also say in the Equivalent (~
) operator for decimals that there is tolerance based on the least-precise operand, but for Equal (=
) is it strictly value-based, so that test really ought to have a .round(8)
on the left-hand side.
Last updated: Apr 12 2022 at 19:14 UTC