1 #ifndef __math_compat_h
2 #define __math_compat_h
6 * @brief Do not use, json-c internal, may be changed or removed at any time.
9 /* Define isnan, isinf, infinity and nan on Windows/MSVC */
11 #ifndef HAVE_DECL_ISNAN
12 #ifdef HAVE_DECL__ISNAN
14 #define isnan(x) _isnan(x)
16 /* On platforms like AIX and "IBM i" we need to provide our own isnan */
17 #define isnan(x) ((x) != (x))
21 #ifndef HAVE_DECL_ISINF
22 #ifdef HAVE_DECL__FINITE
24 #define isinf(x) (!_finite(x))
27 /* On platforms like AIX and "IBM i" we need to provide our own isinf */
28 #define isinf(x) ((x) < -DBL_MAX || (x) > DBL_MAX)
32 #ifndef HAVE_DECL_INFINITY
34 #define INFINITY (DBL_MAX + DBL_MAX)
35 #define HAVE_DECL_INFINITY
39 #define NAN (INFINITY - INFINITY)