float.h 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  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_MC68k 1
  45. #define Sudden_Underflow 1
  46. #endif
  47. #ifdef _PLAN9_SOURCE
  48. /* FCR */
  49. #define FPINEX 0 /* trap enables: none on risc-v */
  50. #define FPUNFL 0
  51. #define FPOVFL 0
  52. #define FPZDIV 0
  53. #define FPINVAL 0
  54. #define FPRNR (0<<5) /* rounding modes */
  55. #define FPRZ (1<<5)
  56. #define FPRPINF (3<<5)
  57. #define FPRNINF (2<<5)
  58. #define FPRMASK (7<<5)
  59. #define FPPEXT 0 /* precision */
  60. #define FPPSGL 0
  61. #define FPPDBL 0
  62. #define FPPMASK 0
  63. /* FSR */
  64. #define FPAINEX (1<<0) /* accrued exceptions */
  65. #define FPAOVFL (1<<2)
  66. #define FPAUNFL (1<<1)
  67. #define FPAZDIV (1<<3)
  68. #define FPAINVAL (1<<4)
  69. #endif
  70. #endif /* __FLOAT */