
Johan RĂ¥de wrote:
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
The date_time library contains the following is_nan function:
static bool is_nan(const T& x) { return std::numeric_limits<T>::has_quiet_NaN && (x != x); }
It has been pointed out by Martin Bonner that this is not safe, for it requires strict IEEE 754 compliance and it may be optimized away by an over-eager optimizing compiler.
FYI, this is basically unused code in that date_time int_adapter (note name) is only ever used with integer types internally. This really should be removed to avoid confusion... Jeff