1 /********************************************************************* 2 * Copyright 2018, University Corporation for Atmospheric Research 3 * See netcdf/README file for copying and redistribution conditions. 4 * Russ Rew 5 *********************************************************************/ 6 #ifndef _ISNAN_H 7 #define _ISNAN_H 8 9 #include "config.h" 10 11 #ifndef NO_FLOAT_H 12 #include <float.h> /* for DBL_MAX */ 13 #endif /* NO_FLOAT_H */ 14 #include <math.h> 15 16 #if ! (defined(isinf) || HAVE_DECL_ISINF) 17 #define isinf(x) (DBL_MAX/((double)(x))==0.0) 18 #endif /* !HAVE_DECL_ISINF */ 19 #if ! (defined(isnan) || HAVE_DECL_ISNAN) 20 #define isnan(x) ((x)!=(x)) 21 #endif /* !HAVE_DECL_ISNAN */ 22 #if ! (defined(isfinite) || HAVE_DECL_ISFINITE) 23 #define isfinite(x) (!(isinf(x)||isnan(x))) 24 #endif /* !HAVE_DECL_ISFINITE */ 25 26 #endif /* _ISNAN_H */ 27