Fernando Cacciola <[EMAIL PROTECTED]> wrote: > Gabriel Dos Reis <[EMAIL PROTECTED]> wrote in
>> 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. Hi, We have an is_nan(float) implementation (for quiet NaNs of course) that does just that. Right now, it supports most compilers on Win32 but it should be straight-forward to support others. Right now, it is tested on: g++2.95.3 (MinGW) g++3.1 (MinGW) Borland 5.5.1 Comeau 4.24 (Win32) Microsoft Visual C++ 6 Microsoft Visual C++ 7 Microsoft Visual C++ 7.1 Metrowerks CodeWarrior 7.2 The default implementation assumes IEEE754 floating point. It takes advantage of the fact that IEEE754 has a well defined binary layout for quiet NaNs. Platform specific implementations forward the call to the correct platform header when available. The code does not rely on the availability of numeric_limits. I hope this can be used as the basis of a standardized boost::is_nan utility. Thoughts? -- Joel de Guzman joel at boost-consulting.com http://www.boost-consulting.com http://spirit.sf.net _______________________________________________ Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost