PLplot  5.15.0
csa/nan.h
Go to the documentation of this file.
1 //--------------------------------------------------------------------------
2 //
3 // File: nan.h
4 //
5 // Created: 18/10/2001
6 //
7 // Author: Pavel Sakov
8 // CSIRO Marine Research
9 //
10 // Purpose: NaN definition
11 //
12 // Description: Should cover machines with 64 bit doubles or other machines
13 // with GCC
14 //
15 // Revisions: None
16 //
17 //--------------------------------------------------------------------------
18 
19 #if !defined ( _NAN_H )
20 #define _NAN_H
21 
22 #if ( defined ( __GNUC__ ) && !defined ( __ICC ) ) || defined ( __BORLANDC__ )
23 
24 static const double NaN = 0.0 / 0.0;
25 
26 #ifdef __BORLANDC__
27  #define isnan _isnan
28  #define copysign _copysign
29 #endif
30 
31 #elif defined ( _WIN32 )
32 
33 #if !defined ( _MSC_VER )
34 
35 static unsigned _int64 lNaN = ( (unsigned _int64) 1 << 63 ) - 1;
36 
37 #define NaN ( *(double *) &lNaN )
38 
39 #else
40 
41 // MSVC/C++ 6.0 reports a version 1200,
42 // MSVC/C++ 2003 reports a version 1300
43 //
44 #include <float.h>
45 #include <ymath.h>
46 #undef NaN
47 #if _MSC_VER < 1300
48 #define NaN _Nan._D
49 #else
50 #define NaN _Nan._Double
51 #endif
52 
53 #define isnan _isnan
54 #define copysign _copysign
55 
56 #endif
57 
58 #else
59 
60 static const long long lNaN = ( (unsigned long long) 1 << 63 ) - 1;
61 
62 #define NaN ( *(double *) &lNaN )
63 
64 #endif
65 
66 #endif
#define NaN
Definition: csa/nan.h:62
static const long long lNaN
Definition: csa/nan.h:60