Re:If 1+x is 1, how much is 1-x?
by dragonwriter on Thursday April 23, 2015 @10:59AM
(#9427160)
Performance optimizations that affect mathematical accuracy are not necessarily "rubbish"; there are certainly cases where they are necessary and appropriate.
OTOH, it is a problem, IMO, that many popular languages make it much easier to use fixed-precision binary floating point representations -- which, while the most performance-optimized way to work with non-integer numbersare also the most prone manifesting incorrect results on real-world inputs -- than any other representation of non-integer numbers.
Use of fixed-precision binary floating point is a performance optimization that, like all such optimizations, should be driven by a real need in the particular application, not just be the default choice because that's what the language makes easiest.
Unfortunately, very few languages make this natural and idiomatic (Scheme and its numeric tower get numbers right, but very few popular languages do.)
OTOH, it is a problem, IMO, that many popular languages make it much easier to use fixed-precision binary floating point representations -- which, while the most performance-optimized way to work with non-integer numbersare also the most prone manifesting incorrect results on real-world inputs -- than any other representation of non-integer numbers.
Use of fixed-precision binary floating point is a performance optimization that, like all such optimizations, should be driven by a real need in the particular application, not just be the default choice because that's what the language makes easiest.
Unfortunately, very few languages make this natural and idiomatic (Scheme and its numeric tower get numbers right, but very few popular languages do.)