math_compat.h 644 B

123456789101112131415161718192021222324252627282930313233343536
  1. #ifndef __math_compat_h
  2. #define __math_compat_h
  3. /**
  4. * @file
  5. * @brief Do not use, json-c internal, may be changed or removed at any time.
  6. */
  7. /* Define isnan, isinf, infinity and nan on Windows/MSVC */
  8. #ifndef HAVE_DECL_ISNAN
  9. # ifdef HAVE_DECL__ISNAN
  10. #include <float.h>
  11. #define isnan(x) _isnan(x)
  12. # endif
  13. #endif
  14. #ifndef HAVE_DECL_ISINF
  15. # ifdef HAVE_DECL__FINITE
  16. #include <float.h>
  17. #define isinf(x) (!_finite(x))
  18. # endif
  19. #endif
  20. #ifndef HAVE_DECL_INFINITY
  21. #include <float.h>
  22. #define INFINITY (DBL_MAX + DBL_MAX)
  23. #define HAVE_DECL_INFINITY
  24. #endif
  25. #ifndef HAVE_DECL_NAN
  26. #define NAN (INFINITY - INFINITY)
  27. #define HAVE_DECL_NAN
  28. #endif
  29. #endif