home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 7 / 07.iso / c / c040 / 6.ddi / INCLUDE / FLOAT.H$ / FLOAT.bin
Encoding:
Text File  |  1989-11-08  |  4.8 KB  |  141 lines

  1. /***
  2. *float.h - constants for floating point values
  3. *
  4. *    Copyright (c) 1985-1990, 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. #if defined(_DLL) && !defined(_MT)
  15. #error Cannot define _DLL without _MT
  16. #endif
  17.  
  18. #ifdef _MT
  19. #define _FAR_ _far
  20. #else
  21. #define _FAR_
  22. #endif
  23.  
  24. #define DBL_DIG     15            /* # of decimal digits of precision */
  25. #define DBL_EPSILON    2.2204460492503131e-016 /* smallest such that 1.0+DBL_EPSILON != 1.0 */
  26. #define DBL_MANT_DIG    53            /* # of bits in mantissa */
  27. #define DBL_MAX     1.7976931348623158e+308 /* max value */
  28. #define DBL_MAX_10_EXP    308            /* max decimal exponent */
  29. #define DBL_MAX_EXP    1024            /* max binary exponent */
  30. #define DBL_MIN     2.2250738585072014e-308 /* min positive value */
  31. #define DBL_MIN_10_EXP    (-307)            /* min decimal exponent */
  32. #define DBL_MIN_EXP    (-1021)         /* min binary exponent */
  33. #define DBL_RADIX    2            /* exponent radix */
  34. #define DBL_ROUNDS    1            /* addition rounding: near */
  35.  
  36. #define FLT_DIG     7            /* # of decimal digits of precision */
  37. #define FLT_EPSILON    1.192092896e-07F     /* smallest such that 1.0+FLT_EPSILON != 1.0 */
  38. #define FLT_GUARD    0
  39. #define FLT_MANT_DIG    24            /* # of bits in mantissa */
  40. #define FLT_MAX     3.402823466e+38F     /* max value */
  41. #define FLT_MAX_10_EXP    38            /* max decimal exponent */
  42. #define FLT_MAX_EXP    128            /* max binary exponent */
  43. #define FLT_MIN     1.175494351e-38F     /* min positive value */
  44. #define FLT_MIN_10_EXP    (-37)            /* min decimal exponent */
  45. #define FLT_MIN_EXP    (-125)            /* min binary exponent */
  46. #define FLT_NORMALIZE    0
  47. #define FLT_RADIX    2            /* exponent radix */
  48. #define FLT_ROUNDS    1            /* addition rounding: near */
  49.  
  50. #define LDBL_DIG    19            /* # of decimal digits of precision */
  51. #define LDBL_EPSILON    5.4210108624275221706e-020  /* smallest such that 1.0+LDBL_EPSILON != 1.0 */
  52. #define LDBL_MANT_DIG    64            /* # of bits in mantissa */
  53. #define LDBL_MAX    1.189731495357231765e+4932L /* max value */
  54. #define LDBL_MAX_10_EXP 4932            /* max decimal exponent */
  55. #define LDBL_MAX_EXP    16384            /* max binary exponent */
  56. #define LDBL_MIN    3.3621031431120935063e-4932L /* min positive value */
  57. #define LDBL_MIN_10_EXP (-4931)         /* min decimal exponent */
  58. #define LDBL_MIN_EXP    (-16381)        /* min binary exponent */
  59. #define LDBL_RADIX    2            /* exponent radix */
  60. #define LDBL_ROUNDS    1            /* addition rounding: near */
  61.  
  62.  
  63. /*
  64.  *  8087/80287 math control information
  65.  */
  66.  
  67.  
  68. /* User Control Word Mask and bit definitions.
  69.  * These definitions match the 8087/80287
  70.  */
  71.  
  72. #define MCW_EM        0x003f        /* interrupt Exception Masks */
  73. #define EM_INVALID    0x0001        /*   invalid */
  74. #define EM_DENORMAL    0x0002        /*   denormal */
  75. #define EM_ZERODIVIDE    0x0004        /*   zero divide */
  76. #define EM_OVERFLOW    0x0008        /*   overflow */
  77. #define EM_UNDERFLOW    0x0010        /*   underflow */
  78. #define EM_INEXACT    0x0020        /*   inexact (precision) */
  79.  
  80. #define MCW_IC        0x1000        /* Infinity Control */
  81. #define IC_AFFINE    0x1000        /*   affine */
  82. #define IC_PROJECTIVE    0x0000        /*   projective */
  83.  
  84. #define MCW_RC        0x0c00        /* Rounding Control */
  85. #define RC_CHOP     0x0c00        /*   chop */
  86. #define RC_UP        0x0800        /*   up */
  87. #define RC_DOWN     0x0400        /*   down */
  88. #define RC_NEAR     0x0000        /*   near */
  89.  
  90. #define MCW_PC        0x0300        /* Precision Control */
  91. #define PC_24        0x0000        /*    24 bits */
  92. #define PC_53        0x0200        /*    53 bits */
  93. #define PC_64        0x0300        /*    64 bits */
  94.  
  95.  
  96. /* initial Control Word value */
  97.  
  98. #define CW_DEFAULT ( IC_AFFINE + RC_NEAR + PC_64 + EM_DENORMAL + EM_UNDERFLOW + EM_INEXACT )
  99.  
  100.  
  101. /* user Status Word bit definitions */
  102.  
  103. #define SW_INVALID    0x0001    /* invalid */
  104. #define SW_DENORMAL    0x0002    /* denormal */
  105. #define SW_ZERODIVIDE    0x0004    /* zero divide */
  106. #define SW_OVERFLOW    0x0008    /* overflow */
  107. #define SW_UNDERFLOW    0x0010    /* underflow */
  108. #define SW_INEXACT    0x0020    /* inexact (precision) */
  109.  
  110.  
  111. /* invalid subconditions (SW_INVALID also set) */
  112.  
  113. #define SW_UNEMULATED        0x0040    /* unemulated instruction */
  114. #define SW_SQRTNEG        0x0080    /* square root of a neg number */
  115. #define SW_STACKOVERFLOW    0x0200    /* FP stack overflow */
  116. #define SW_STACKUNDERFLOW    0x0400    /* FP stack underflow */
  117.  
  118.  
  119. /*  Floating point error signals and return codes */
  120.  
  121. #define FPE_INVALID        0x81
  122. #define FPE_DENORMAL        0x82
  123. #define FPE_ZERODIVIDE        0x83
  124. #define FPE_OVERFLOW        0x84
  125. #define FPE_UNDERFLOW        0x85
  126. #define FPE_INEXACT        0x86
  127.  
  128. #define FPE_UNEMULATED        0x87
  129. #define FPE_SQRTNEG        0x88
  130. #define FPE_STACKOVERFLOW    0x8a
  131. #define FPE_STACKUNDERFLOW    0x8b
  132.  
  133. #define FPE_EXPLICITGEN     0x8c    /* raise( SIGFPE ); */
  134.  
  135. /* function prototypes */
  136.  
  137. unsigned int _FAR_ _cdecl _clear87(void);
  138. unsigned int _FAR_ _cdecl _control87(unsigned int, unsigned int);
  139. void _FAR_ _cdecl _fpreset(void);
  140. unsigned int _FAR_ _cdecl _status87(void);
  141.