Sorting floating-point values, and NaN
Bigsandwich
bigsandwich at gmail.com
Tue Nov 12 10:25:04 PST 2013
> Both of the above hinge on the relative obscurity of NaNs and
> the problems they could cause. People who are not specifically
> familiar with NaNs and how they interact with other
> floating-point values will treat floating-point values as "just
> numbers", and expect them to compare and sort in the same way
> as integers.
Please, please, please just no. As someone who works with
floating point daily, you cannot idiot proof it like this. They
will never behave like "just numbers" and you can't make them.
Even leaving out NAN, you have issues with precision, accumulated
error, denormals, equality comparison, and on and on.
If you don't know what you are doing with them, then you just
shouldn't be touching them. Unicode has similar issues.
More information about the Digitalmars-d
mailing list