3 ms·
> But in Haskell you have, for example, Rational numbers to avoid many such problems. Hey, it's for sure nice to have a rich numeric stack (see also some lisp
by ska 7y ago
> But in Haskell you have, for example, Rational numbers to avoid many such problems.
Hey, it's for sure nice to have a rich numeric stack (see also some lisps), but in numeric work "use something else" is very rarely a practical answer to issues with IEEE-754.
- JoelMcCracken 7y agoSure, it is, but the thing is that a hugely significant amount of the time I've seen those NaNs happen is because of a lack of understanding/care on the part of the devs, and not because they are doing scientific computing. There seem to be a large disconnect here. A big chunk of people don't need the speed that FP math brings, what they need is exactness. And, for most languages with a C-based lineage, actually correct floating point math support seems to fit in the "someday/maybe" categories.
- eru 7y agoYes, rational numbers are the better default choice. You should get floats only when you ask for them.
- JoelMcCracken 7y agoUnfortunately, for many languages, its the only real choice (without introducing some new significant dependency!)