How many NaNs do we now have?

Sam Ruby rubys at intertwingly.net
Mon Aug 25 16:20:26 PDT 2008


On Mon, Aug 25, 2008 at 7:03 PM, Waldemar Horwat <waldemar at google.com> wrote:
> What should compareTotal do when you compare -NaN and NaN?

Re: the subject line; NaN's have a payload that corresponds to the
size of the mantissa.

As to the definition of CompareTotal, here's what it contained on
Mike's web site[1]:

This function compares two numbers using the IEEE 754 total ordering.
If the lhs is less than the rhs in the total order then the number
will be set to the value -1. If they are equal, then number is set to
0. If the lhs is greater than the rhs then the number will be set to
the value 1.

The total order differs from the numerical comparison in that: –NaN <
–sNaN < –Infinity < –finites < –0 < +0 < +finites < +Infinity < +sNaN
< +NaN. Also, 1.000 < 1.0 (etc.) and NaNs are ordered by payload.

>    Waldemar

[1] http://speleotrove.com/decimal/dnnumb.html


More information about the Es-discuss mailing list