4 Jul 15:40
Re: sorting floats by casting to integer
Thomas Klimpel <Thomas.Klimpel <at> synopsys.com>
2009-07-04 13:40:03 GMT
2009-07-04 13:40:03 GMT
Simonson, Lucanus J wrote: > If you think about it, if casting to integer to compare floating point values is faster, > why doesn't the processor do that itself? I have been told that some processors do. Some floating point values that don't correspond to real numbers (like INF and NaN) have a very complicated behavior with respect to comparison. At least I remember that std::sort used to crash when trying to sort data containing NaNs. I think it has something to do with "a < b" being somehow related to "(a-b) < 0" or "0 < (b-a)" and a minus operation involving a NaN must yield a NaN. _______________________________________________ Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
RSS Feed