home *** CD-ROM | disk | FTP | other *** search
/ Programming Languages Suite / ProgLangD.iso / C++-7 / DISK4 / INCLUDE / FLOAT.H$ / FLOAT
Encoding:
Text File  |  1991-11-06  |  6.5 KB  |  214 lines

  1. /***
  2. *float.h - constants for floating point values
  3. *
  4. *    Copyright (c) 1985-1992, Microsoft Corporation.  All rights reserved.
  5. *
  6. *Purpose:
  7. *    This file contains defines for a number of implementation dependent
  8. *    values which are commonly used by sophisticated numerical (floating
  9. *    point) programs.
  10. *    [ANSI]
  11. *
  12. ****/
  13.  
  14. #ifndef _INC_FLOAT
  15.  
  16. #ifdef __cplusplus
  17. extern "C" {
  18. #endif
  19.  
  20. #if (_MSC_VER <= 600)
  21. #define __cdecl     _cdecl
  22. #define __far       _far
  23. #endif
  24.  
  25. #define DBL_DIG     15            /* # of decimal digits of precision */
  26. #define DBL_EPSILON    2.2204460492503131e-016 /* smallest such that 1.0+DBL_EPSILON != 1.0 */
  27. #define DBL_MANT_DIG    53            /* # of bits in mantissa */
  28. #define DBL_MAX     1.7976931348623158e+308 /* max value */
  29. #define DBL_MAX_10_EXP    308            /* max decimal exponent */
  30. #define DBL_MAX_EXP    1024            /* max binary exponent */
  31. #define DBL_MIN     2.2250738585072014e-308 /* min positive value */
  32. #define DBL_MIN_10_EXP    (-307)            /* min decimal exponent */
  33. #define DBL_MIN_EXP    (-1021)         /* min binary exponent */
  34. #define _DBL_RADIX    2            /* exponent radix */
  35. #define _DBL_ROUNDS    1            /* addition rounding: near */
  36.  
  37. #define FLT_DIG     6            /* # of decimal digits of precision */
  38. #define FLT_EPSILON    1.192092896e-07F     /* smallest such that 1.0+FLT_EPSILON != 1.0 */
  39. #define FLT_GUARD    0
  40. #define FLT_MANT_DIG    24            /* # of bits in mantissa */
  41. #define FLT_MAX     3.402823466e+38F     /* max value */
  42. #define FLT_MAX_10_EXP    38            /* max decimal exponent */
  43. #define FLT_MAX_EXP    128            /* max binary exponent */
  44. #define FLT_MIN     1.175494351e-38F     /* min positive value */
  45. #define FLT_MIN_10_EXP    (-37)            /* min decimal exponent */
  46. #define FLT_MIN_EXP    (-125)            /* min binary exponent */
  47. #define FLT_NORMALIZE    0
  48. #define FLT_RADIX    2            /* exponent radix */
  49. #define FLT_ROUNDS    1            /* addition rounding: near */
  50.  
  51. #define LDBL_DIG    18            /* # of decimal digits of precision */
  52. #define LDBL_EPSILON    1.084202172485504434e-019L /* smallest such that 1.0+LDBL_EPSILON != 1.0 */
  53. #define LDBL_MANT_DIG    64            /* # of bits in mantissa */
  54. #define LDBL_MAX    1.189731495357231765e+4932L /* max value */
  55. #define LDBL_MAX_10_EXP 4932            /* max decimal exponent */
  56. #define LDBL_MAX_EXP    16384            /* max binary exponent */
  57. #define LDBL_MIN    3.3621031431120935063e-4932L /* min positive value */
  58. #define LDBL_MIN_10_EXP (-4931)         /* min decimal exponent */
  59. #define LDBL_MIN_EXP    (-16381)        /* min binary exponent */
  60. #define _LDBL_RADIX    2            /* exponent radix */
  61. #define _LDBL_ROUNDS    1            /* addition rounding: near */
  62.  
  63.  
  64. /*
  65.  *  8087/80287 math control information
  66.  */
  67.  
  68.  
  69. /* User Control Word Mask and bit definitions.
  70.  * These definitions match the 8087/80287
  71.  */
  72.  
  73. #define _MCW_EM     0x003f        /* interrupt Exception Masks */
  74. #define _EM_INVALID    0x0001        /*   invalid */
  75. #define _EM_DENORMAL    0x0002        /*   denormal */
  76. #define _EM_ZERODIVIDE    0x0004        /*   zero divide */
  77. #define _EM_OVERFLOW    0x0008        /*   overflow */
  78. #define _EM_UNDERFLOW    0x0010        /*   underflow */
  79. #define _EM_INEXACT    0x0020        /*   inexact (precision) */
  80.  
  81. #define _MCW_IC     0x1000        /* Infinity Control */
  82. #define _IC_AFFINE    0x1000        /*   affine */
  83. #define _IC_PROJECTIVE    0x0000        /*   projective */
  84.  
  85. #define _MCW_RC     0x0c00        /* Rounding Control */
  86. #define _RC_CHOP    0x0c00        /*   chop */
  87. #define _RC_UP        0x0800        /*   up */
  88. #define _RC_DOWN    0x0400        /*   down */
  89. #define _RC_NEAR    0x0000        /*   near */
  90.  
  91. #define _MCW_PC     0x0300        /* Precision Control */
  92. #define _PC_24        0x0000        /*    24 bits */
  93. #define _PC_53        0x0200        /*    53 bits */
  94. #define _PC_64        0x0300        /*    64 bits */
  95.  
  96.  
  97. /* initial Control Word value */
  98.  
  99. #define _CW_DEFAULT ( _IC_AFFINE + _RC_NEAR + _PC_64 + _EM_DENORMAL + _EM_UNDERFLOW + _EM_INEXACT )
  100.  
  101.  
  102. /* user Status Word bit definitions */
  103.  
  104. #define _SW_INVALID    0x0001    /* invalid */
  105. #define _SW_DENORMAL    0x0002    /* denormal */
  106. #define _SW_ZERODIVIDE    0x0004    /* zero divide */
  107. #define _SW_OVERFLOW    0x0008    /* overflow */
  108. #define _SW_UNDERFLOW    0x0010    /* underflow */
  109. #define _SW_INEXACT    0x0020    /* inexact (precision) */
  110.  
  111.  
  112. /* invalid subconditions (_SW_INVALID also set) */
  113.  
  114. #define _SW_UNEMULATED        0x0040    /* unemulated instruction */
  115. #define _SW_SQRTNEG        0x0080    /* square root of a neg number */
  116. #define _SW_STACKOVERFLOW    0x0200    /* FP stack overflow */
  117. #define _SW_STACKUNDERFLOW    0x0400    /* FP stack underflow */
  118.  
  119.  
  120. /*  Floating point error signals and return codes */
  121.  
  122. #define _FPE_INVALID        0x81
  123. #define _FPE_DENORMAL        0x82
  124. #define _FPE_ZERODIVIDE     0x83
  125. #define _FPE_OVERFLOW        0x84
  126. #define _FPE_UNDERFLOW        0x85
  127. #define _FPE_INEXACT        0x86
  128.  
  129. #define _FPE_UNEMULATED     0x87
  130. #define _FPE_SQRTNEG        0x88
  131. #define _FPE_STACKOVERFLOW    0x8a
  132. #define _FPE_STACKUNDERFLOW    0x8b
  133.  
  134. #define _FPE_EXPLICITGEN    0x8c    /* raise( SIGFPE ); */
  135.  
  136.  
  137. /* function prototypes */
  138.  
  139. unsigned int __cdecl _clear87(void);
  140. unsigned int __cdecl _control87(unsigned int, unsigned int);
  141. void __cdecl _fpreset(void);
  142. unsigned int __cdecl _status87(void);
  143.  
  144.  
  145. #ifndef __STDC__
  146. /* Non-ANSI names for compatibility */
  147.  
  148. #define DBL_RADIX        _DBL_RADIX
  149. #define DBL_ROUNDS        _DBL_ROUNDS
  150.  
  151. #define LDBL_RADIX        _LDBL_RADIX
  152. #define LDBL_ROUNDS        _LDBL_ROUNDS
  153.  
  154. #define MCW_EM            _MCW_EM
  155. #define EM_INVALID        _EM_INVALID
  156. #define EM_DENORMAL        _EM_DENORMAL
  157. #define EM_ZERODIVIDE        _EM_ZERODIVIDE
  158. #define EM_OVERFLOW        _EM_OVERFLOW
  159. #define EM_UNDERFLOW        _EM_UNDERFLOW
  160. #define EM_INEXACT        _EM_INEXACT
  161.  
  162. #define MCW_IC            _MCW_IC
  163. #define IC_AFFINE        _IC_AFFINE
  164. #define IC_PROJECTIVE        _IC_PROJECTIVE
  165.  
  166. #define MCW_RC            _MCW_RC
  167. #define RC_CHOP         _RC_CHOP
  168. #define RC_UP            _RC_UP
  169. #define RC_DOWN         _RC_DOWN
  170. #define RC_NEAR         _RC_NEAR
  171.  
  172. #define MCW_PC            _MCW_PC
  173. #define PC_24            _PC_24
  174. #define PC_53            _PC_53
  175. #define PC_64            _PC_64
  176.  
  177. #define CW_DEFAULT        _CW_DEFAULT
  178.  
  179. #define SW_INVALID        _SW_INVALID
  180. #define SW_DENORMAL        _SW_DENORMAL
  181. #define SW_ZERODIVIDE        _SW_ZERODIVIDE
  182. #define SW_OVERFLOW        _SW_OVERFLOW
  183. #define SW_UNDERFLOW        _SW_UNDERFLOW
  184. #define SW_INEXACT        _SW_INEXACT
  185.  
  186. #define SW_UNEMULATED        _SW_UNEMULATED
  187. #define SW_SQRTNEG        _SW_SQRTNEG
  188. #define SW_STACKOVERFLOW    _SW_STACKOVERFLOW
  189. #define SW_STACKUNDERFLOW    _SW_STACKUNDERFLOW
  190.  
  191. #define FPE_INVALID        _FPE_INVALID
  192. #define FPE_DENORMAL        _FPE_DENORMAL
  193. #define FPE_ZERODIVIDE        _FPE_ZERODIVIDE
  194. #define FPE_OVERFLOW        _FPE_OVERFLOW
  195. #define FPE_UNDERFLOW        _FPE_UNDERFLOW
  196. #define FPE_INEXACT        _FPE_INEXACT
  197.  
  198. #define FPE_UNEMULATED        _FPE_UNEMULATED
  199. #define FPE_SQRTNEG        _FPE_SQRTNEG
  200. #define FPE_STACKOVERFLOW    _FPE_STACKOVERFLOW
  201. #define FPE_STACKUNDERFLOW    _FPE_STACKUNDERFLOW
  202.  
  203. #define FPE_EXPLICITGEN     _FPE_EXPLICITGEN
  204.  
  205. #endif    /* __STDC__ */
  206.  
  207.  
  208. #ifdef __cplusplus
  209. }
  210. #endif
  211.  
  212. #define _INC_FLOAT
  213. #endif    /* _INC_FLOAT */
  214.