News for hackers. Stuff that matters.
Re:Python wats by Veedrac on Sunday October 11, 2015 @12:51PM (#10369987)
It's still unfortunate that `x + 1.0` rounds incorrectly. Python is one of the few languages that has correct (infinite-precision) float-int comparisons, so it's reasonable to expect addition to work similarly.

That said, I'm not aware of a language that does better, and I'm aware of many that do much worse.

Re:Python wats by renox on Tuesday October 13, 2015 @09:15AM (#10380182)
There is Frink (http://futureboy.us/frinkdocs/) which has interval arithmetic which seems so much more sane than floating point numbers..
Re:Python wats by Veedrac on Tuesday October 13, 2015 @12:47PM (#10381672)
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 ;).