Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Because they are equal in real math


Floats are not real numbers though


They are a way of approximating Real (the set not as an adjective) numbers, though. Real numbers are exact when they are equal to an integer or a rational, because, depending on how you construct them, either that's what the cut contains or that's where the series converges.

And also because that's what the most common spec demands.


Floats are a subset of the reals.


floating point math is math like any other, just with a vastly different number system. There are valid arguments on both side if we should hide or expose those differences in the implementation, but there's always going to be pretty big implications (i.e. the compiler behaviour mentioned here)


Yes but this is floating point - +0.0 represents all numbers between 0 and the smallest +ve FP number, -0.0 represents all numbers between 0 and the smallest -ve FP number - both can represent actual 0 - remember these can be generated by underflow so those meanings can be important in context




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: