News for hackers. Stuff that matters.
Re:Amazon open-sources Ion – a binary and text interchangabl... by Ericson2314 on Thursday April 21, 2016 @10:20PM (#11546657)
> Decimal maintains precision: -0. != -0.0

What? This means their "arbitrary-precision decimals" are actually isomorphic to (Rational x Natural).

Re:Amazon open-sources Ion – a binary and text interchangabl... by alextgordon on Thursday April 21, 2016 @10:39PM (#11546734)
The 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
Re:Amazon open-sources Ion – a binary and text interchangabl... by Ericson2314 on Thursday April 21, 2016 @11:03PM (#11546804)
That 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.
Re:Amazon open-sources Ion – a binary and text interchangabl... by tjonker on Friday April 22, 2016 @12:16AM (#11547026)
I'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.
Re:Amazon open-sources Ion – a binary and text interchangabl... by Ericson2314 on Friday April 22, 2016 @11:07AM (#11549719)
The idea is each number is adequately precise in that additional precision would mean additional useless trailing zeros.
Re:Amazon open-sources Ion – a binary and text interchangabl... by tjonker on Friday April 22, 2016 @12:04AM (#11547002)
The "!=" 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.