
Joe Gottman wrote:
Several libraries have an is_nan() function buried deep in the code. Are there any plans to make a general is_nan function available? This would be quite useful, as well as similar functions like is_finite.
Joe Gottman
_______________________________________________ Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
An interesting observation: The is_nan implementation x!=x works, while !((x<=0)||(x>=0)) does not work on VC++ 7.1, with optimizations turned on. It seems that !((x<=0)||(x>=0)) is evaluated to false at compile time while x!=x is evaluated at run time. Could it be that the compiler has a special rule that says, do not optimize the expression x!=x, precisely because it is a common implementation of isnan? Does anyone know if x!=x actually fails on any real world platform? Maybe we should just keep using x!=x ? --Johan Råde