home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 7 / 07.iso / c / c081_11 / 2.ddi / INCLUDE.ZIP / FLOAT.H < prev    next >
Encoding:
C/C++ Source or Header  |  1991-02-13  |  5.0 KB  |  160 lines

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