4 ms·
> and did you know that IEEE-754 floating point can represent a "negative zero" that you can use for an error code in functions that return float or double? I
by snek 7y ago
> and did you know that IEEE-754 floating point can represent a "negative zero" that you can use for an error code in functions that return float or double?
I am begging, please never ever do this. NaN literally exists for this reason. NaN even allows you to encode additional error context and details into the value.
- saagarjha 7y ago+DBL_MAX. Negative zero is an entirely valid, if rare, result of certain computations.
- pwdisswordfish2 7y agoIEEE 754 has infinities as well, no need to constrain yourself to DBL_MAX :)