On Wed, 3 Dec 2014, Sven Schreiber wrote:
Am 03.12.2014 um 16:59 schrieb Allin Cottrell:
>
> It's more complicated than that, and msortby is actually not doing
> anything odd. What's odd, I gather, is the behavior of the Microsoft C
> library in the cases you said came out "OK".
How can I test the C library behavior? Maybe a simple C code snippet --
but compiling on a non-dev Windows machine is tricky I guess?
I tried a little test program on Windows 8. It turns out that the C
library does return 0 for all comparisons involving a NaN (>, < and
==), as it should. Nonetheless, qsort() with our original simple
callback sorts NaN (invoked via 0.0/0.0) to the start of an array of
doubles. I don't know how that happens!
Allin