float.h 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. #ifndef __FLOAT
  2. #define __FLOAT
  3. /* IEEE, default rounding */
  4. #define FLT_ROUNDS 1
  5. #define FLT_RADIX 2
  6. #define FLT_DIG 6
  7. #define FLT_EPSILON 1.19209290e-07
  8. #define FLT_MANT_DIG 24
  9. #define FLT_MAX 3.40282347e+38
  10. #define FLT_MAX_10_EXP 38
  11. #define FLT_MAX_EXP 128
  12. #define FLT_MIN 1.17549435e-38
  13. #define FLT_MIN_10_EXP -37
  14. #define FLT_MIN_EXP -125
  15. #define DBL_DIG 15
  16. #define DBL_EPSILON 2.2204460492503131e-16
  17. #define DBL_MANT_DIG 53
  18. #define DBL_MAX 1.797693134862315708145e+308
  19. #define DBL_MAX_10_EXP 308
  20. #define DBL_MAX_EXP 1024
  21. #define DBL_MIN 2.225073858507201383090233e-308
  22. #define DBL_MIN_10_EXP -307
  23. #define DBL_MIN_EXP -1021
  24. #define LDBL_MANT_DIG DBL_MANT_DIG
  25. #define LDBL_EPSILON DBL_EPSILON
  26. #define LDBL_DIG DBL_DIG
  27. #define LDBL_MIN_EXP DBL_MIN_EXP
  28. #define LDBL_MIN DBL_MIN
  29. #define LDBL_MIN_10_EXP DBL_MIN_10_EXP
  30. #define LDBL_MAX_EXP DBL_MAX_EXP
  31. #define LDBL_MAX DBL_MAX
  32. #define LDBL_MAX_10_EXP DBL_MAX_10_EXP
  33. typedef union FPdbleword FPdbleword;
  34. union FPdbleword
  35. {
  36. double x;
  37. struct { /* little endian */
  38. long lo;
  39. long hi;
  40. };
  41. };
  42. #ifdef _RESEARCH_SOURCE
  43. /* define stuff needed for floating conversion */
  44. #define IEEE_8087 1
  45. #define Sudden_Underflow 1
  46. #endif
  47. #ifdef _PLAN9_SOURCE
  48. /* MXCSR */
  49. /* fcr */
  50. #define FPFTZ (1<<15) /* amd64 */
  51. #define FPINEX (1<<12)
  52. #define FPUNFL (1<<11)
  53. #define FPOVFL (1<<10)
  54. #define FPZDIV (1<<9)
  55. #define FPDNRM (1<<8) /* amd64 */
  56. #define FPINVAL (1<<7)
  57. #define FPDAZ (1<<6) /* amd64 */
  58. #define FPRNR (0<<13)
  59. #define FPRZ (3<<13)
  60. #define FPRPINF (2<<13)
  61. #define FPRNINF (1<<13)
  62. #define FPRMASK (3<<13)
  63. #define FPPEXT 0
  64. #define FPPSGL 0
  65. #define FPPDBL 0
  66. #define FPPMASK 0
  67. /* fsr */
  68. #define FPAINEX (1<<5)
  69. #define FPAUNFL (1<<4)
  70. #define FPAOVFL (1<<3)
  71. #define FPAZDIV (1<<2)
  72. #define FPADNRM (1<<1) /* not in plan 9 */
  73. #define FPAINVAL (1<<0)
  74. #endif
  75. #endif /* __FLOAT */