2 ms·
I looked at Frink a little; it doesn't seem to implement integer-floating addition properly either. 9999999999999999999002 + 49.0 rounds to 9.999999999999
by Veedrac 11y ago
I looked at Frink a little; it doesn't seem to implement integer-floating addition properly either.
9999999999999999999002 + 49.0
rounds to 9.9999999999999999990e+21, whereas the lesser value
9999999999999999999000 + 50.0
rounds to 9.9999999999999999991e+21.
Plus, I'm not a fan of computing with decimal arithmetic, since it's less stable. For instance,
min(a, b) <= (a + b) / 2 <= max(a, b)
doesn't always hold for decimal floats, whereas it does for (non-overflowing) binary floats. Decimals are generally more prone to this kind of inaccuracy, since they lose more bits when the exponent changes.
(Consider a = 1.00000000000000000001, b = 1.00000000000000000003.)
Interval arithmetic support is cool, but not useful without effort - bounds like to grow. Plus, Python has bindings for them anyway ;).