Subversion Repositories Kolibri OS

Rev

Blame | Last modification | View Log | Download | RSS feed

  1. /* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */
  2. #ifndef __dj_include_float_h_
  3. #define __dj_include_float_h_
  4.  
  5. #ifdef __cplusplus
  6. extern "C" {
  7. #endif
  8.  
  9. extern float __dj_float_epsilon;
  10. extern float __dj_float_max;
  11. extern float __dj_float_min;
  12.  
  13. #define FLT_DIG         6
  14. #define FLT_EPSILON     __dj_float_epsilon
  15. #define FLT_MANT_DIG    24
  16. #define FLT_MAX         __dj_float_max
  17. #define FLT_MAX_10_EXP  38
  18. #define FLT_MAX_EXP     128
  19. #define FLT_MIN         __dj_float_min
  20. #define FLT_MIN_10_EXP  (-37)
  21. #define FLT_MIN_EXP     (-125)
  22. #define FLT_RADIX       2
  23. #define FLT_ROUNDS      1
  24.  
  25. extern double __dj_double_epsilon;
  26. extern double __dj_double_max;
  27. extern double __dj_double_min;
  28.  
  29. #define DBL_DIG         15
  30. #define DBL_EPSILON     __dj_double_epsilon
  31. #define DBL_MANT_DIG    53
  32. #define DBL_MAX         __dj_double_max
  33. #define DBL_MAX_10_EXP  308
  34. #define DBL_MAX_EXP     1024
  35. #define DBL_MIN         __dj_double_min
  36. #define DBL_MIN_10_EXP  (-307)
  37. #define DBL_MIN_EXP     (-1021)
  38.  
  39. extern long double __dj_long_double_epsilon;
  40. extern long double __dj_long_double_max;
  41. extern long double __dj_long_double_min;
  42.  
  43. #define LDBL_DIG        18
  44. #define LDBL_EPSILON    __dj_long_double_epsilon
  45. #define LDBL_MANT_DIG   64
  46. #define LDBL_MAX        __dj_long_double_max
  47. #define LDBL_MAX_10_EXP 4932
  48. #define LDBL_MAX_EXP    16384
  49. #define LDBL_MIN        __dj_long_double_min
  50. #define LDBL_MIN_10_EXP (-4931)
  51. #define LDBL_MIN_EXP    (-16381)
  52.  
  53. #ifndef __dj_ENFORCE_ANSI_FREESTANDING
  54.  
  55. #ifndef __STRICT_ANSI__
  56.  
  57. #ifndef _POSIX_SOURCE
  58.  
  59. /* These indicate the results of the last operation */
  60. #define SW_INVALID      0x0001  /* Invalid operation */
  61. #define SW_DENORMAL     0x0002  /* Denormalized operand */
  62. #define SW_ZERODIVIDE   0x0004  /* Division by zero */
  63. #define SW_OVERFLOW     0x0008  /* Overflow */
  64. #define SW_UNDERFLOW    0x0010  /* Underflow (computational) */
  65. #define SW_INEXACT      0x0020  /* Precision (computational) */
  66. #define SW_STACKFAULT   0x0040  /* Stack Fault (over/under flow) */
  67. #define SW_ERRORSUMMARY 0x0080  /* Error summary */
  68. #define SW_COND         0x4700  /* Condition Code */
  69. #define SW_C0           0x0100  /* Condition 0 bit */
  70. #define SW_C1           0x0200  /* Condition 1 bit (also 0=stack underflow, 1=stack overflow) */
  71. #define SW_C2           0x0400  /* Condition 2 bit */
  72. #define SW_C3           0x4000  /* Condition 3 bit */
  73. #define SW_TOP          0x3800  /* Top of stack */
  74. #define SW_TOP_SHIFT    11      /* Shift to move TOS to LSB */
  75. #define SW_BUSY         0x8000  /* FPU busy */
  76.  
  77. #define MCW_EM          0x003f  /* Exception masks (0=fault, 1=handle) */
  78. #define EM_INVALID      0x0001  /* Invalid operation */
  79. #define EM_DENORMAL     0x0002  /* Denormalized operand */
  80. #define EM_ZERODIVIDE   0x0004  /* Division by zero */
  81. #define EM_OVERFLOW     0x0008  /* Overflow */
  82. #define EM_UNDERFLOW    0x0010  /* Underflow */
  83. #define EM_INEXACT      0x0020  /* Precision */
  84.  
  85. #define MCW_PC          0x0300  /* precision control */
  86. #define PC_24           0x0000  /* 24 bits (single precision) */
  87. #define PC_53           0x0200  /* 53 bits (double precision) */
  88. #define PC_64           0x0300  /* 64 bits (extended precision) */
  89.  
  90. #define MCW_RC          0x0c00  /* Rounding control */
  91. #define RC_NEAR         0x0000  /* Round to nearest or even */
  92. #define RC_DOWN         0x0400  /* Round towards -Inf */
  93. #define RC_UP           0x0800  /* Round towards +Inf */
  94. #define RC_CHOP         0x0c00  /* Truncate towards zero */
  95.  
  96. #define MCW_IC          0x1000  /* obsolete; i486 is always affine */
  97. #define IC_AFFINE       0x1000  /* -Inf < +Inf */
  98. #define IC_PROJECTIVE   0x0000  /* -Inf == +Inf */
  99.  
  100. unsigned int _clear87(void);
  101. unsigned int _control87(unsigned int newcw, unsigned int mask);
  102. void         _fpreset(void);
  103. unsigned int _status87(void);
  104.  
  105. #endif /* !_POSIX_SOURCE */
  106. #endif /* !__STRICT_ANSI__ */
  107. #endif /* !__dj_ENFORCE_ANSI_FREESTANDING */
  108.  
  109. #ifndef __dj_ENFORCE_FUNCTION_CALLS
  110. #endif /* !__dj_ENFORCE_FUNCTION_CALLS */
  111.  
  112. #ifdef __cplusplus
  113. }
  114. #endif
  115.  
  116. #endif /* !__dj_include_float_h_ */
  117.