|
|
1.1 root 1: /***
2: *float.h - constants for floating point values
3: *
4: * Copyright (c) 1985-1991, 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:
1.1.1.2 ! root 21: #ifndef MIPS
1.1 root 22: #if (_MSC_VER <= 600)
23: #define __cdecl _cdecl
24: #endif
1.1.1.2 ! root 25: #endif
1.1 root 26:
27: #define DBL_DIG 15 /* # of decimal digits of precision */
28: #define DBL_EPSILON 2.2204460492503131e-016 /* smallest such that 1.0+DBL_EPSILON != 1.0 */
29: #define DBL_MANT_DIG 53 /* # of bits in mantissa */
30: #define DBL_MAX 1.7976931348623158e+308 /* max value */
31: #define DBL_MAX_10_EXP 308 /* max decimal exponent */
32: #define DBL_MAX_EXP 1024 /* max binary exponent */
33: #define DBL_MIN 2.2250738585072014e-308 /* min positive value */
34: #define DBL_MIN_10_EXP (-307) /* min decimal exponent */
35: #define DBL_MIN_EXP (-1021) /* min binary exponent */
36: #define _DBL_RADIX 2 /* exponent radix */
37: #define _DBL_ROUNDS 1 /* addition rounding: near */
38:
39: #define FLT_DIG 6 /* # of decimal digits of precision */
40: #define FLT_EPSILON 1.192092896e-07F /* smallest such that 1.0+FLT_EPSILON != 1.0 */
41: #define FLT_GUARD 0
42: #define FLT_MANT_DIG 24 /* # of bits in mantissa */
43: #define FLT_MAX 3.402823466e+38F /* max value */
44: #define FLT_MAX_10_EXP 38 /* max decimal exponent */
45: #define FLT_MAX_EXP 128 /* max binary exponent */
46: #define FLT_MIN 1.175494351e-38F /* min positive value */
47: #define FLT_MIN_10_EXP (-37) /* min decimal exponent */
48: #define FLT_MIN_EXP (-125) /* min binary exponent */
49: #define FLT_NORMALIZE 0
50: #define FLT_RADIX 2 /* exponent radix */
51: #define FLT_ROUNDS 1 /* addition rounding: near */
52:
53: #define LDBL_DIG DBL_DIG /* # of decimal digits of precision */
54: #define LDBL_EPSILON DBL_EPSILON /* smallest such that 1.0+LDBL_EPSILON != 1.0 */
55: #define LDBL_MANT_DIG DBL_MANT_DIG /* # of bits in mantissa */
56: #define LDBL_MAX DBL_MAX /* max value */
57: #define LDBL_MAX_10_EXP DBL_MAX_10_EXP /* max decimal exponent */
58: #define LDBL_MAX_EXP DBL_MAX_EXP /* max binary exponent */
59: #define LDBL_MIN DBL_MIN /* min positive value */
60: #define LDBL_MIN_10_EXP DBL_MIN_10_EXP /* min decimal exponent */
61: #define LDBL_MIN_EXP DBL_MIN_EXP /* min binary exponent */
62: #define _LDBL_RADIX DBL_RADIX /* exponent radix */
63: #define _LDBL_ROUNDS DBL_ROUNDS /* addition rounding: near */
64:
65:
66:
1.1.1.2 ! root 67:
! 68: /* function prototypes */
! 69:
! 70: unsigned int _clearfp(void);
! 71: unsigned int _controlfp(unsigned int,unsigned int);
! 72: unsigned int _statusfp(void);
! 73: void _fpreset(void);
! 74:
! 75: #define _clear87 _clearfp
! 76: #define _status87 _statusfp
! 77:
1.1 root 78: /*
1.1.1.2 ! root 79: * Abstract User Control Word Mask and bit definitions
1.1 root 80: */
81:
1.1.1.2 ! root 82: #define _MCW_EM 0x0008001f /* interrupt Exception Masks */
! 83: #define _EM_INEXACT 0x00000001 /* inexact (precision) */
! 84: #define _EM_UNDERFLOW 0x00000002 /* underflow */
! 85: #define _EM_OVERFLOW 0x00000004 /* overflow */
! 86: #define _EM_ZERODIVIDE 0x00000008 /* zero divide */
! 87: #define _EM_INVALID 0x00000010 /* invalid */
! 88:
! 89: #define _MCW_RC 0x00000300 /* Rounding Control */
! 90: #define _RC_NEAR 0x00000000 /* near */
! 91: #define _RC_DOWN 0x00000100 /* down */
! 92: #define _RC_UP 0x00000200 /* up */
! 93: #define _RC_CHOP 0x00000300 /* chop */
1.1 root 94:
1.1.1.2 ! root 95: /*
! 96: * Abstract User Status Word bit definitions
1.1 root 97: */
98:
1.1.1.2 ! root 99: #define _SW_INEXACT 0x00000001 /* inexact (precision) */
! 100: #define _SW_UNDERFLOW 0x00000002 /* underflow */
! 101: #define _SW_OVERFLOW 0x00000004 /* overflow */
! 102: #define _SW_ZERODIVIDE 0x00000008 /* zero divide */
! 103: #define _SW_INVALID 0x00000010 /* invalid */
1.1 root 104:
105:
1.1.1.2 ! root 106: /*
! 107: * i386 specific definitions
! 108: */
1.1 root 109:
1.1.1.2 ! root 110: #define _MCW_PC 0x00030000 /* Precision Control */
! 111: #define _PC_64 0x00000000 /* 64 bits */
! 112: #define _PC_53 0x00010000 /* 53 bits */
! 113: #define _PC_24 0x00020000 /* 24 bits */
! 114:
! 115: #define _MCW_IC 0x00040000 /* Infinity Control */
! 116: #define _IC_AFFINE 0x00040000 /* affine */
! 117: #define _IC_PROJECTIVE 0x00000000 /* projective */
1.1 root 118:
1.1.1.2 ! root 119: #define _EM_DENORMAL 0x00080000 /* denormal exception mask (_control87 only) */
1.1 root 120:
1.1.1.2 ! root 121: #define _SW_DENORMAL 0x00080000 /* denormal status bit */
1.1 root 122:
123:
1.1.1.2 ! root 124: unsigned int _control87(unsigned int,unsigned int);
1.1 root 125:
126:
1.1.1.2 ! root 127: /*
! 128: * MIPS R4000 specific definitions
! 129: */
! 130:
! 131: #define _MCW_DN 0x01000000 /* Denormal Control (R4000) */
! 132: #define _DN_FLUSH 0x01000000 /* flush to zero */
! 133: #define _DN_SAVE 0x00000000 /* save */
1.1 root 134:
135:
1.1.1.2 ! root 136: /* initial Control Word value */
! 137:
! 138: #ifdef i386
! 139:
! 140: #define _CW_DEFAULT ( _RC_NEAR + _PC_64 + _EM_INVALID + _EM_ZERODIVIDE + _EM_OVERFLOW + _EM_UNDERFLOW + _EM_INEXACT )
! 141:
! 142: #endif
! 143:
! 144: #ifdef MIPS
! 145:
! 146: #define _CW_DEFAULT ( _RC_NEAR + _DN_FLUSH + _EM_INVALID + _EM_ZERODIVIDE + _EM_OVERFLOW + _EM_UNDERFLOW + _EM_INEXACT )
! 147:
! 148: #endif
! 149:
1.1 root 150: /* Global variable holding floating point error code */
151:
152: #ifdef _MT
153: extern int * __fpecode(void);
154: #define _fpecode (*__fpecode())
155: #else
156: extern int _fpecode;
157: #endif
158:
1.1.1.2 ! root 159: /* invalid subconditions (_SW_INVALID also set) */
! 160:
! 161: #define _SW_UNEMULATED 0x0040 /* unemulated instruction */
! 162: #define _SW_SQRTNEG 0x0080 /* square root of a neg number */
! 163: #define _SW_STACKOVERFLOW 0x0200 /* FP stack overflow */
! 164: #define _SW_STACKUNDERFLOW 0x0400 /* FP stack underflow */
1.1 root 165:
166: /* Floating point error signals and return codes */
167:
168: #define _FPE_INVALID 0x81
169: #define _FPE_DENORMAL 0x82
170: #define _FPE_ZERODIVIDE 0x83
171: #define _FPE_OVERFLOW 0x84
172: #define _FPE_UNDERFLOW 0x85
173: #define _FPE_INEXACT 0x86
174:
175: #define _FPE_UNEMULATED 0x87
176: #define _FPE_SQRTNEG 0x88
177: #define _FPE_STACKOVERFLOW 0x8a
178: #define _FPE_STACKUNDERFLOW 0x8b
179:
180: #define _FPE_EXPLICITGEN 0x8c /* raise( SIGFPE ); */
181:
182:
1.1.1.2 ! root 183: /* IEEE recommended functions */
! 184:
! 185: double _copysign (double, double);
! 186: double _chgsign (double);
! 187: double _scalb(double, long);
! 188: double _logb(double);
! 189: double _nextafter(double, double);
! 190: int _finite(double);
! 191: int _isnan(double);
! 192: int _fpclass(double);
! 193:
! 194: #define _FPCLASS_SNAN 0x0001 /* signaling NaN */
! 195: #define _FPCLASS_QNAN 0x0002 /* quiet NaN */
! 196: #define _FPCLASS_NINF 0x0004 /* negative infinity */
! 197: #define _FPCLASS_NN 0x0008 /* negative normal */
! 198: #define _FPCLASS_ND 0x0010 /* negative denormal */
! 199: #define _FPCLASS_NZ 0x0020 /* -0 */
! 200: #define _FPCLASS_PZ 0x0040 /* +0 */
! 201: #define _FPCLASS_PD 0x0080 /* positive denormal */
! 202: #define _FPCLASS_PN 0x0100 /* positive normal */
! 203: #define _FPCLASS_PINF 0x0200 /* positive infinity */
1.1 root 204:
205:
206: #if !__STDC__
207: /* Non-ANSI names for compatibility */
208:
1.1.1.2 ! root 209: #define clear87 _clear87
! 210: #define status87 _status87
! 211: #define control87 _control87
! 212: #define fpreset _fpreset
! 213:
1.1 root 214: #define DBL_RADIX _DBL_RADIX
215: #define DBL_ROUNDS _DBL_ROUNDS
216:
217: #define LDBL_RADIX _LDBL_RADIX
218: #define LDBL_ROUNDS _LDBL_ROUNDS
219:
220: #define MCW_EM _MCW_EM
221: #define EM_INVALID _EM_INVALID
222: #define EM_DENORMAL _EM_DENORMAL
223: #define EM_ZERODIVIDE _EM_ZERODIVIDE
224: #define EM_OVERFLOW _EM_OVERFLOW
225: #define EM_UNDERFLOW _EM_UNDERFLOW
226: #define EM_INEXACT _EM_INEXACT
227:
228: #define MCW_IC _MCW_IC
229: #define IC_AFFINE _IC_AFFINE
230: #define IC_PROJECTIVE _IC_PROJECTIVE
231:
232: #define MCW_RC _MCW_RC
233: #define RC_CHOP _RC_CHOP
234: #define RC_UP _RC_UP
235: #define RC_DOWN _RC_DOWN
236: #define RC_NEAR _RC_NEAR
237:
238: #define MCW_PC _MCW_PC
239: #define PC_24 _PC_24
240: #define PC_53 _PC_53
241: #define PC_64 _PC_64
242:
243: #define CW_DEFAULT _CW_DEFAULT
244:
245: #define SW_INVALID _SW_INVALID
246: #define SW_DENORMAL _SW_DENORMAL
247: #define SW_ZERODIVIDE _SW_ZERODIVIDE
248: #define SW_OVERFLOW _SW_OVERFLOW
249: #define SW_UNDERFLOW _SW_UNDERFLOW
250: #define SW_INEXACT _SW_INEXACT
251:
252: #define SW_UNEMULATED _SW_UNEMULATED
253: #define SW_SQRTNEG _SW_SQRTNEG
254: #define SW_STACKOVERFLOW _SW_STACKOVERFLOW
255: #define SW_STACKUNDERFLOW _SW_STACKUNDERFLOW
256:
257: #define FPE_INVALID _FPE_INVALID
258: #define FPE_DENORMAL _FPE_DENORMAL
259: #define FPE_ZERODIVIDE _FPE_ZERODIVIDE
260: #define FPE_OVERFLOW _FPE_OVERFLOW
261: #define FPE_UNDERFLOW _FPE_UNDERFLOW
262: #define FPE_INEXACT _FPE_INEXACT
263:
264: #define FPE_UNEMULATED _FPE_UNEMULATED
265: #define FPE_SQRTNEG _FPE_SQRTNEG
266: #define FPE_STACKOVERFLOW _FPE_STACKOVERFLOW
267: #define FPE_STACKUNDERFLOW _FPE_STACKUNDERFLOW
268:
269: #define FPE_EXPLICITGEN _FPE_EXPLICITGEN
270:
271:
1.1.1.2 ! root 272: #endif /* __STDC__ */
1.1 root 273:
274: #ifdef __cplusplus
275: }
276: #endif
277:
278: #define _INC_FLOAT
279: #endif /* _INC_FLOAT */
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.