Main Page | Data Structures | Directories | File List | Data Fields | Globals

nan.h

Go to the documentation of this file.
00001 #ifndef __NAN_H__
00002 #define __NAN_H__
00003 
00004 #include <math.h>
00005 
00006 // Provide a portable replacement for isnan if it was not provided by math.h
00007 #ifndef isnan
00008 # define isnan(x) \
00009   (sizeof (x) == sizeof (long double) ? isnan_ld (x) \
00010    : sizeof (x) == sizeof (double) ? isnan_d (x) \
00011    : isnan_f (x))
00012 static inline int isnan_f  (float       x) { return x != x; }
00013 static inline int isnan_d  (double      x) { return x != x; }
00014 static inline int isnan_ld (long double x) { return x != x; }
00015 #endif
00016 
00017 // Provide a portable replacement for isinf if it was not provided by math.h
00018 #ifndef isinf
00019 # define isinf(x) \
00020   (sizeof (x) == sizeof (long double) ? isinf_ld (x) \
00021    : sizeof (x) == sizeof (double) ? isinf_d (x) \
00022    : isinf_f (x))
00023 static inline int isinf_f  (float       x) { return isnan (x - x); }
00024 static inline int isinf_d  (double      x) { return isnan (x - x); }
00025 static inline int isinf_ld (long double x) { return isnan (x - x); }
00026 #endif
00027 
00028 #define NAN (0.0/0.0)
00029 #define PINF (1.0/0.0)
00030 #define NINF (-1.0/0.0)
00031 
00032 #endif
00033 

Generated on Thu Sep 6 13:13:10 2007 for driver by  doxygen 1.3.9.1