Guillaume Melquiond <[EMAIL PROTECTED]> writes:

| On Fri, 4 Jul 2003, Fernando Cacciola wrote:
| 
| > Gabriel Dos Reis <[EMAIL PROTECTED]> wrote in message
| > news:[EMAIL PROTECTED]
| > > "jvd" <[EMAIL PROTECTED]> 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.
| 
| Yes, it is incorrect for C++. But it's something we can hope to see one
| day. For example, in the LIA-1 annex I about C langage bindings, it is
| written that != is a binding for IEEE-754 ?<> operator (unordered
| compare). In the C9X annex F.8.3 about relational operators, it is written
| that the optimization "x != x -> false" is not allowed since "The
| statement x != x is true if x is a NaN". And so on.

You seem to forget that C99 does not consider Signalling NaNs -- which
are other missing parts of C99.  For those NaNs, the comparaison might
just trap.

Please, be careful when quoting.

-- Gaby
_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost

Reply via email to