• Main Page
  • Namespaces
  • Classes
  • Files
  • File List
  • File Members

nan.h

Go to the documentation of this file.
00001 //--------------------------------------------------------------------------
00002 //
00003 // File:           nan.h
00004 //
00005 // Created:        18/10/2001
00006 //
00007 // Author:         Pavel Sakov
00008 //                 CSIRO Marine Research
00009 //
00010 // Purpose:        NaN definition
00011 //
00012 // Description:    Should cover machines with 64 bit doubles or other machines
00013 //                 with GCC
00014 //
00015 // Revisions:      None
00016 //
00017 //--------------------------------------------------------------------------
00018 
00019 #if !defined ( _NAN_H )
00020 #define _NAN_H
00021 
00022 #if ( defined ( __GNUC__ ) && !defined ( __ICC ) ) || defined ( __BORLANDC__ )
00023 
00024 static const double NaN = 0.0 / 0.0;
00025 
00026 #ifdef __BORLANDC__
00027   #define isnan       _isnan
00028   #define copysign    _copysign
00029 #endif
00030 
00031 #elif defined ( WIN32 )
00032 
00033 #if !defined ( _MSC_VER )
00034 
00035 static unsigned _int64 lNaN = ( (unsigned _int64) 1 << 63 ) - 1;
00036 
00037 #define NaN    ( *(double *) &lNaN )
00038 
00039 #else
00040 
00041 // MSVC/C++ 6.0 reports a version 1200,
00042 // MSVC/C++ 2003 reports a version 1300
00043 //
00044 #include <float.h>
00045 #include <ymath.h>
00046 #undef NaN
00047 #if _MSC_VER < 1300
00048 #define NaN         _Nan._D
00049 #else
00050 #define NaN         _Nan._Double
00051 #endif
00052 
00053 #define isnan       _isnan
00054 #define copysign    _copysign
00055 
00056 #endif
00057 
00058 #else
00059 
00060 static const long long lNaN = ( (unsigned long long) 1 << 63 ) - 1;
00061 
00062 #define NaN    ( *(double *) &lNaN )
00063 
00064 #endif
00065 
00066 #endif
00067 
00068 
00069 //#if !defined(_NAN_H)
00070 // #define _NAN_H
00071 //
00072 // #if defined(__GNUC__)
00073 // static const double NaN = 0.0 / 0.0;
00074 // #elif defined(BIG_ENDIAN) || defined(_BIG_ENDIAN)
00075 // static const long long lNaN = 0x7fffffffffffffff;
00076 //
00077 // #define NaN (*(double*)&lNaN)
00078 // #else
00079 // static const long long lNaN = 0xfff8000000000000;
00080 //
00081 // #define NaN (*(double*)&lNaN)
00082 // #endif
00083 //
00084 // #endif

Generated on Wed Oct 12 2011 20:42:21 for PLplot by  doxygen 1.7.1