home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 7 / 07.iso / c / c063 / 1.ddi / INCLUDE.ZIP / FLOAT.H < prev    next >
Encoding:
C/C++ Source or Header  |  1992-02-18  |  4.8 KB  |  146 lines

  1. /*  float.h
  2.  
  3.     Defines implementation specific macros for dealing with
  4.     floating point.
  5.  
  6.     Copyright (c) 1987, 1991 by Borland International
  7.     All Rights Reserved.
  8. */
  9.  
  10. #ifndef __FLOAT_H
  11. #define __FLOAT_H
  12.  
  13. #if !defined( __DEFS_H )
  14. #include <_defs.h>
  15. #endif
  16.  
  17. #define FLT_RADIX           2
  18. #define FLT_ROUNDS          1
  19. #define FLT_GUARD           1
  20. #define FLT_NORMALIZE       1
  21.  
  22. #define DBL_DIG             15
  23. #define FLT_DIG             6
  24. #define LDBL_DIG            19
  25.  
  26. #define DBL_MANT_DIG        53
  27. #define FLT_MANT_DIG        24
  28. #define LDBL_MANT_DIG       64
  29.  
  30. #define DBL_EPSILON         2.2204460492503131E-16
  31. #define FLT_EPSILON         1.19209290E-07F
  32. #define LDBL_EPSILON        1.084202172485504E-19
  33.  
  34. /* smallest positive IEEE normal numbers */
  35. #define DBL_MIN             2.2250738585072014E-308
  36. #define FLT_MIN             1.17549435E-38F
  37. #define LDBL_MIN            _tiny_ldble
  38.  
  39. #define DBL_MAX             _huge_dble
  40. #define FLT_MAX             _huge_flt
  41. #define LDBL_MAX            _huge_ldble
  42.  
  43. #define DBL_MAX_EXP         +1024
  44. #define FLT_MAX_EXP         +128
  45. #define LDBL_MAX_EXP        +16384
  46.  
  47. #define DBL_MAX_10_EXP      +308
  48. #define FLT_MAX_10_EXP      +38
  49. #define LDBL_MAX_10_EXP     +4932
  50.  
  51. #define DBL_MIN_10_EXP      -307
  52. #define FLT_MIN_10_EXP      -37
  53. #define LDBL_MIN_10_EXP     -4931
  54.  
  55. #define DBL_MIN_EXP         -1021
  56. #define FLT_MIN_EXP         -125
  57. #define LDBL_MIN_EXP        -16381
  58.  
  59. extern float        _Cdecl _huge_flt;
  60. extern double       _Cdecl _huge_dble;
  61. extern long double  _Cdecl _huge_ldble;
  62. extern long double  _Cdecl _tiny_ldble;
  63.  
  64. #ifdef __cplusplus
  65. extern "C" {
  66. #endif
  67. unsigned int _Cdecl _clear87(void);
  68. unsigned int _Cdecl _control87(unsigned int __newcw, unsigned int __mask);
  69. void         _Cdecl _fpreset(void);
  70. unsigned int _Cdecl _status87(void);
  71. #ifdef __cplusplus
  72. }
  73. #endif
  74.  
  75. #if !__STDC__
  76.  
  77. /* 8087/80287 Status Word format   */
  78.  
  79. #define SW_INVALID      0x0001  /* Invalid operation            */
  80. #define SW_DENORMAL     0x0002  /* Denormalized operand         */
  81. #define SW_ZERODIVIDE   0x0004  /* Zero divide                  */
  82. #define SW_OVERFLOW     0x0008  /* Overflow                     */
  83. #define SW_UNDERFLOW    0x0010  /* Underflow                    */
  84. #define SW_INEXACT      0x0020  /* Precision (Inexact result)   */
  85.  
  86. /* 8087/80287 Control Word format */
  87.  
  88. #define MCW_EM              0x003f  /* interrupt Exception Masks*/
  89. #define     EM_INVALID      0x0001  /*   invalid                */
  90. #define     EM_DENORMAL     0x0002  /*   denormal               */
  91. #define     EM_ZERODIVIDE   0x0004  /*   zero divide            */
  92. #define     EM_OVERFLOW     0x0008  /*   overflow               */
  93. #define     EM_UNDERFLOW    0x0010  /*   underflow              */
  94. #define     EM_INEXACT      0x0020  /*   inexact (precision)    */
  95.  
  96. #define MCW_IC              0x1000  /* Infinity Control */
  97. #define     IC_AFFINE       0x1000  /*   affine         */
  98. #define     IC_PROJECTIVE   0x0000  /*   projective     */
  99.  
  100. #define MCW_RC          0x0c00  /* Rounding Control     */
  101. #define     RC_CHOP     0x0c00  /*   chop               */
  102. #define     RC_UP       0x0800  /*   up                 */
  103. #define     RC_DOWN     0x0400  /*   down               */
  104. #define     RC_NEAR     0x0000  /*   near               */
  105.  
  106. #define MCW_PC          0x0300  /* Precision Control    */
  107. #define     PC_24       0x0000  /*    24 bits           */
  108. #define     PC_53       0x0200  /*    53 bits           */
  109. #define     PC_64       0x0300  /*    64 bits           */
  110.  
  111. /* 8087/80287 Initial Control Word */
  112. /* use affine infinity, mask underflow and precision exceptions */
  113.  
  114. #define CW_DEFAULT  _default87
  115. extern unsigned int _Cdecl _default87;
  116.  
  117. /* 
  118.     SIGFPE signal error types (for integer & float exceptions). 
  119. */
  120. #define FPE_INTOVFLOW       126 /* 80x86 Interrupt on overflow  */
  121. #define FPE_INTDIV0         127 /* 80x86 Integer divide by zero */
  122.  
  123. #define FPE_INVALID         129 /* 80x87 invalid operation      */
  124. #define FPE_ZERODIVIDE      131 /* 80x87 divide by zero         */
  125. #define FPE_OVERFLOW        132 /* 80x87 arithmetic overflow    */
  126. #define FPE_UNDERFLOW       133 /* 80x87 arithmetic underflow   */
  127. #define FPE_INEXACT         134 /* 80x87 precision loss         */
  128. #define FPE_STACKFAULT      135 /* 80x87 stack overflow         */
  129. #define FPE_EXPLICITGEN     140 /* When SIGFPE is raise()'d     */
  130.  
  131. /* 
  132.             SIGSEGV signal error types.
  133. */
  134. #define SEGV_BOUND          10  /* A BOUND violation (SIGSEGV)  */
  135. #define SEGV_EXPLICITGEN    11  /* When SIGSEGV is raise()'d    */
  136.  
  137. /* 
  138.             SIGILL signal error types.
  139. */
  140. #define ILL_EXECUTION       20  /* Illegal operation exception  */
  141. #define ILL_EXPLICITGEN     21  /* When SIGILL is raise()'d     */
  142.  
  143. #endif  /* !__STDC__ */
  144.  
  145. #endif
  146.