3 ms·
> More proof that floats are evil. Just because someone doesn't know the basics of floating point numbers it doesn't mean that the floating point format is som
by geezerjay 10y ago
> More proof that floats are evil.
Just because someone doesn't know the basics of floating point numbers it doesn't mean that the floating point format is somehow evil.
Testing floats for equality is one of those no-nos which is taught right in the first class of introduction to FP numbers.
Another very basic issue covered right in the intro clsses are problems caused by using decimal values to define numbers encoded in binary format, which is often explained through the famous "0.1 doesn't exist in binary" trivia bit.
- thechao 10y agoPart of my day job is to test floating point hardware and write compilers and assemblers. Testing equality---with some care---is completely fine. I can assure you this is a bug in GCC. The GCC bug is compounded by the nonstandard behavior of x87. The x87 unit is not "fixable" but GCC's behavior is.
- nurettin 10y agoThat's interesting, you make it sound like the production of new FPUs and new compilers is common. Which industry do you work in?