From: Jeff Garland (jeff_at_[hidden])
Date: 2006-07-26 09:16:15


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://listarchives.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