3 ms·
tl;dr "We switched from floats to rationals." Because we made out calculator in JavaScript. Relatedly, lately I've been thinking of floats not as numbers but
by hoseja 7y ago
tl;dr "We switched from floats to rationals."
Because we made out calculator in JavaScript.
Relatedly, lately I've been thinking of floats not as numbers but as number intervals. Their arithmetic doesn't really work that way but it's much better intuition for all the weirdness.
- taneq 7y agoYeah, a float isn't a number, it's a number with an error bar.
- jimhefferon 7y agoOne awkwardness with interval arithmetic is that after twenty or thirty multiplications the error bar can get large enough to make the answer not useful. Twenty or thirty is not a large number in many reasonable calculations, for instance with finite element calculations or Markov chanis.
- taneq 7y agoThis is actually a really important factor that a lot of code just ignores. Floats are decent general purpose numbers for a lot of uses but they come with a whole bunch of caveats where you can lose a lot of precision really fast.
- gjm11 7y agoThey switched from floats to rationals falling back to floats when the numerator or denominator gets large. And I don't see that Javascript deserves any particular praise or blame for that choice; it would be a perfectly reasonable way to implement a calculator in any language.