Boost logo

Boost :

From: Fernando Cacciola (fernando_cacciola_at_[hidden])
Date: 2003-07-04 12:16:28


Gabriel Dos Reis <gdr_at_[hidden]> wrote in message
news:m31xx6i7tm.fsf_at_uniton.integrable-solutions.net...
> "jvd" <vygis_d_at_[hidden]> writes:
>
> | Dear boosters,
> |
> | seems like this code
> |
> | template< typename T >
> | bool is_nan( const T& v )
> | {
> | return std::numeric_limits<T>::has_quiet_NaN && (v != v);
> | }
> |
> | does not work correctly on some machines.
>
> Yes. It is an incorrect (unfortunately popular) implementation.
>
Right. We should say that more often. It is incorrect however popular.

Most compilers provide a non standard extension for this purpose.
For instance, Borland uses _isnan.
In general, these extensions are found on <float>.
The best approach, IMO, is to have a boost::is_nan() with compiler specific
implementations.

Fernando Cacciola


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk