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