3 ms·
Because they are equal in real math
by ilyt 4y ago
Because they are equal in real math
- Taniwha 4y agoYes 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
- zokier 4y agoFloats are not real numbers though
- deleted 4y ago[deleted]
- garbagecoder 4y agoThey 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.
- recursive 4y agoFloats are a subset of the reals.
- yifanl 4y agofloating 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)