3 ms·
> 0 and -0 being distinct values is honestly just an accident of convenience with how floats are stored This is actually a valid distinction because these valu
by mFixman 3y ago
> 0 and -0 being distinct values is honestly just an accident of convenience with how floats are stored
This is actually a valid distinction because these values can represent different values.
Floating point values are not numbers, but ranges of possible values: float -0 is a number in the range (-FLT_TRUE_MIN / 2, 0] and float +0 is a number in the range [0, FLT_TRUE_MIN).
IMO if I were to redesign IEEE 754 I would add a third float 0 value that always represents exactly 0 and redefine float -0 and float +0 as open limits, but that would probably make everything a lot more complicated.