float.h 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. /*
  2. * This file is part of the UCB release of Plan 9. It is subject to the license
  3. * terms in the LICENSE file found in the top-level directory of this
  4. * distribution and at http://akaros.cs.berkeley.edu/files/Plan9License. No
  5. * part of the UCB release of Plan 9, including this file, may be copied,
  6. * modified, propagated, or distributed except according to the terms contained
  7. * in the LICENSE file.
  8. */
  9. #ifndef __FLOAT
  10. #define __FLOAT
  11. /* IEEE, default rounding */
  12. #define FLT_ROUNDS 1
  13. #define FLT_RADIX 2
  14. #define FLT_DIG 6
  15. #define FLT_EPSILON 1.19209290e-07
  16. #define FLT_MANT_DIG 24
  17. #define FLT_MAX 3.40282347e+38
  18. #define FLT_MAX_10_EXP 38
  19. #define FLT_MAX_EXP 128
  20. #define FLT_MIN 1.17549435e-38
  21. #define FLT_MIN_10_EXP -37
  22. #define FLT_MIN_EXP -125
  23. #define DBL_DIG 15
  24. #define DBL_EPSILON 2.2204460492503131e-16
  25. #define DBL_MANT_DIG 53
  26. #define DBL_MAX 1.797693134862315708145e+308
  27. #define DBL_MAX_10_EXP 308
  28. #define DBL_MAX_EXP 1024
  29. #define DBL_MIN 2.225073858507201383090233e-308
  30. #define DBL_MIN_10_EXP -307
  31. #define DBL_MIN_EXP -1021
  32. #define LDBL_MANT_DIG DBL_MANT_DIG
  33. #define LDBL_EPSILON DBL_EPSILON
  34. #define LDBL_DIG DBL_DIG
  35. #define LDBL_MIN_EXP DBL_MIN_EXP
  36. #define LDBL_MIN DBL_MIN
  37. #define LDBL_MIN_10_EXP DBL_MIN_10_EXP
  38. #define LDBL_MAX_EXP DBL_MAX_EXP
  39. #define LDBL_MAX DBL_MAX
  40. #define LDBL_MAX_10_EXP DBL_MAX_10_EXP
  41. typedef union FPdbleword FPdbleword;
  42. union FPdbleword
  43. {
  44. double x;
  45. struct { /* big endian */
  46. long hi;
  47. long lo;
  48. };
  49. };
  50. #ifdef _RESEARCH_SOURCE
  51. /* define order of longs in IEEE double: little endian */
  52. #define IEEE_MC68k 1
  53. #define Sudden_Underflow 1
  54. #endif
  55. #ifdef _PLAN9_SOURCE
  56. /* FCR */
  57. #define FPINEX (1<<23)
  58. #define FPOVFL (1<<26)
  59. #define FPUNFL (1<<25)
  60. #define FPZDIV (1<<24)
  61. #define FPRNR (0<<30)
  62. #define FPRZ (1<<30)
  63. #define FPRPINF (2<<30)
  64. #define FPRNINF (3<<30)
  65. #define FPRMASK (3<<30)
  66. #define FPPEXT 0
  67. #define FPPSGL 0
  68. #define FPPDBL 0
  69. #define FPPMASK 0
  70. /* FSR */
  71. #define FPAINEX (1<<5)
  72. #define FPAOVFL (1<<8)
  73. #define FPAUNFL (1<<7)
  74. #define FPAZDIV (1<<6)
  75. #endif
  76. #endif /* __FLOAT */