4 ms·
> Decimal maintains precision: -0. != -0.0 What? This means their "arbitrary-precision decimals" are actually isomorphic to (Rational x Natural).
by Ericson2314 11y ago
> Decimal maintains precision: -0. != -0.0
What? This means their "arbitrary-precision decimals" are actually isomorphic to (Rational x Natural).
- alextgordon 11y agoThe use of != there is very confusing but what they mean is stores a precision along each number, not that -0 != -0.0 e.g. in Python: >>> from decimal import Decimal as D >>> 2 * D("1.0") Decimal('2.0') >>> 2 * D("1.000") Decimal('2.000') >>> D("1.0") == D("1.000") True
- Ericson2314 11y agoThat just means == is a "lossy" equivalence relation. I rather the precision be truely observable----every number is "infinite precision". Once can always include natural as extra field if one cares about empirical precision.
- tjonker 11y agoI'm having a bit of trouble parsing this, but Ion decimal values are not "infinite precision". Every decimal has a very specific, finite precision. It's a standard "coefficient and exponent" model, with no specification-enforced limit on either.
- Ericson2314 11y agoThe idea is each number is adequately precise in that additional precision would mean additional useless trailing zeros.
- tjonker 11y agoThe "!=" means "not the same value according to the Ion data model". The Ion value 0.0 has one digit of precision (after the decimal point), while the value 0.00 has two. In the Ion data model, those are two distinct values, and conforming implementations must maintain the distinction.