Re: Support for decimal type

>
> On summing a series of amounts I was getting values like 136.6000000345,
>
>
> If you deal with xs:decimal throughout, you shouldn't get that kind of
> results in the first place unless you do divisions, assuming the source
> data is good.
>
> On what authority do you claim that?
>
> I can't find a anything that says decimal addition must be done exactly.
> Can you provide a reference?
>

It's here:

    https://www.w3.org/TR/xpath-functions-31/#op.numeric

"For xs:decimal values, let N be the number of digits of precision
supported by the implementation, and let M (M <= N) be the minimum limit on
the number of digits required for conformance (18 digits for XSD 1.0, 16
digits for XSD 1.1). Then for addition, subtraction, and multiplication
operations, the returned result should be accurate to N digits of
precision, and for division and modulus operations, the returned result
should be accurate to at least M digits of precision. The actual precision
is ·implementation-defined·. If the number of digits in the mathematical
result exceeds the number of digits that the implementation retains for
that operation, the result is truncated or rounded in an
·implementation-defined· manner."

-Erik

Received on Thursday, 25 January 2018 16:55:05 UTC