2015-03-11 15:54:33 +00:00
|
|
|
--- a/math_compat.h
|
|
|
|
+++ b/math_compat.h
|
2020-09-16 23:02:40 +00:00
|
|
|
@@ -6,38 +6,9 @@
|
2019-04-30 13:43:25 +00:00
|
|
|
* @brief Do not use, json-c internal, may be changed or removed at any time.
|
|
|
|
*/
|
2015-03-11 15:54:33 +00:00
|
|
|
|
2019-04-30 13:43:25 +00:00
|
|
|
-/* Define isnan, isinf, infinity and nan on Windows/MSVC */
|
2015-03-11 15:54:33 +00:00
|
|
|
-
|
|
|
|
-#ifndef HAVE_DECL_ISNAN
|
2020-06-18 06:20:15 +00:00
|
|
|
-#ifdef HAVE_DECL__ISNAN
|
2015-03-11 15:54:33 +00:00
|
|
|
-#include <float.h>
|
|
|
|
-#define isnan(x) _isnan(x)
|
2020-09-16 23:02:40 +00:00
|
|
|
-#else
|
|
|
|
-/* On platforms like AIX and "IBM i" we need to provide our own isnan */
|
|
|
|
-#define isnan(x) ((x) != (x))
|
2020-06-18 06:20:15 +00:00
|
|
|
-#endif
|
2015-03-11 15:54:33 +00:00
|
|
|
-#endif
|
|
|
|
-
|
|
|
|
-#ifndef HAVE_DECL_ISINF
|
2020-06-18 06:20:15 +00:00
|
|
|
-#ifdef HAVE_DECL__FINITE
|
2015-03-11 15:54:33 +00:00
|
|
|
-#include <float.h>
|
|
|
|
-#define isinf(x) (!_finite(x))
|
2020-09-16 23:02:40 +00:00
|
|
|
-#else
|
|
|
|
-#include <float.h>
|
|
|
|
-/* On platforms like AIX and "IBM i" we need to provide our own isinf */
|
|
|
|
-#define isinf(x) ((x) < -DBL_MAX || (x) > DBL_MAX)
|
2020-06-18 06:20:15 +00:00
|
|
|
-#endif
|
2015-03-11 15:54:33 +00:00
|
|
|
-#endif
|
|
|
|
-
|
2019-04-30 13:43:25 +00:00
|
|
|
-#ifndef HAVE_DECL_INFINITY
|
|
|
|
-#include <float.h>
|
|
|
|
-#define INFINITY (DBL_MAX + DBL_MAX)
|
|
|
|
-#define HAVE_DECL_INFINITY
|
2015-03-11 15:54:33 +00:00
|
|
|
-#endif
|
|
|
|
-
|
2019-04-30 13:43:25 +00:00
|
|
|
-#ifndef HAVE_DECL_NAN
|
|
|
|
-#define NAN (INFINITY - INFINITY)
|
|
|
|
-#define HAVE_DECL_NAN
|
2015-03-11 15:54:33 +00:00
|
|
|
-#endif
|
|
|
|
+#undef isnan
|
|
|
|
+#define isnan(x) __builtin_isnan(x)
|
|
|
|
+#undef isinf
|
|
|
|
+#define isinf(x) __builtin_isinf(x)
|
|
|
|
|
|
|
|
#endif
|