float.h 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. #ifndef _BITS_FLOAT_H
  2. #define _BITS_FLOAT_H
  3. #define FLT_ROUNDS (flt_rounds())
  4. // Shamelessly copy pasted from musl:
  5. #define FLT_TRUE_MIN 1.40129846432481707092e-45F
  6. #define FLT_MIN 1.17549435082228750797e-38F
  7. #define FLT_MAX 3.40282346638528859812e+38F
  8. #define FLT_EPSILON 1.1920928955078125e-07F
  9. #define FLT_MANT_DIG 24
  10. #define FLT_MIN_EXP (-125)
  11. #define FLT_MAX_EXP 128
  12. #define FLT_HAS_SUBNORM 1
  13. #define FLT_DIG 6
  14. #define FLT_DECIMAL_DIG 9
  15. #define FLT_MIN_10_EXP (-37)
  16. #define FLT_MAX_10_EXP 38
  17. #define DBL_TRUE_MIN 4.94065645841246544177e-324
  18. #define DBL_MIN 2.22507385850720138309e-308
  19. #define DBL_MAX 1.79769313486231570815e+308
  20. #define DBL_EPSILON 2.22044604925031308085e-16
  21. #define DBL_MANT_DIG 53
  22. #define DBL_MIN_EXP (-1021)
  23. #define DBL_MAX_EXP 1024
  24. #define DBL_HAS_SUBNORM 1
  25. #define DBL_DIG 15
  26. #define DBL_DECIMAL_DIG 17
  27. #define DBL_MIN_10_EXP (-307)
  28. #define DBL_MAX_10_EXP 308
  29. #define LDBL_HAS_SUBNORM 1
  30. #define LDBL_DECIMAL_DIG DECIMAL_DIG
  31. // TODO: Support more architectures than x86_64 here:
  32. #define LDBL_TRUE_MIN 3.6451995318824746025e-4951L
  33. #define LDBL_MIN 3.3621031431120935063e-4932L
  34. #define LDBL_MAX 1.1897314953572317650e+4932L
  35. #define LDBL_EPSILON 1.0842021724855044340e-19L
  36. #define LDBL_MANT_DIG 64
  37. #define LDBL_MIN_EXP (-16381)
  38. #define LDBL_MAX_EXP 16384
  39. #endif