float.h 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  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 { /* big endian */
  38. long hi;
  39. long lo;
  40. };
  41. };
  42. #ifdef _RESEARCH_SOURCE
  43. /* define stuff needed for floating conversion */
  44. #define IEEE_MC68k 1
  45. #define Sudden_Underflow 1
  46. #endif
  47. #ifdef _PLAN9_SOURCE
  48. /* FCR */
  49. #define FPINEX (1<<7)
  50. #define FPOVFL (1<<9)
  51. #define FPUNFL (1<<8)
  52. #define FPZDIV (1<<10)
  53. #define FPRNR (0<<0)
  54. #define FPRZ (1<<0)
  55. #define FPRPINF (2<<0)
  56. #define FPRNINF (3<<0)
  57. #define FPRMASK (3<<0)
  58. #define FPPEXT 0
  59. #define FPPSGL 0
  60. #define FPPDBL 0
  61. #define FPPMASK 0
  62. /* FSR */
  63. #define FPAINEX (1<<2)
  64. #define FPAOVFL (1<<4)
  65. #define FPAUNFL (1<<3)
  66. #define FPAZDIV (1<<5)
  67. #endif
  68. #endif /* __FLOAT */