Sorting floating-point values, and NaN

Walter Bright newshound2 at digitalmars.com
Tue Nov 12 12:48:39 PST 2013


On 11/12/2013 10:25 AM, Bigsandwich wrote:
> 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.

I think it's apropos to reference this famous document:

"What Every Computer Scientist Should Know About Floating-Point Arithmetic"

http://docs.oracle.com/cd/E19957-01/806-3568/ncg_goldberg.html

I know, I know, RTFM, but one cannot ignore this stuff and write professional 
quality fp code, nor is it practical to have the language ignore it for you.


More information about the Digitalmars-d mailing list