|
|
1.1 root 1: /***
2: * fpieee.h - Definitions for floating point IEEE exception handling
3: *
1.1.1.2 ! root 4: * Copyright (c) 1991-1993, Microsoft Corporation. All rights reserved.
1.1 root 5: *
6: *Purpose:
7: * This file contains constant and type definitions for handling
8: * floating point exceptions [ANSI/IEEE std. 754]
9: *
10: *******************************************************************************/
11:
12: #ifndef _INC_FPIEEE
13:
14: #ifdef __cplusplus
15: extern "C" {
16: #endif
17:
18:
19: /*
20: * Conditional macro definition for function calling type and variable type
21: * qualifiers.
22: */
23: #if ( (_MSC_VER >= 800) && (_M_IX86 >= 300) )
24:
25: /*
26: * Definitions for MS C8-32 (386/486) compiler
27: */
28: #define _CRTAPI1 __cdecl
29: #define _CRTAPI2 __cdecl
30:
31: #else
32:
33: /*
34: * Other compilers (e.g., MIPS)
35: */
36: #define _CRTAPI1
37: #define _CRTAPI2
38:
39: #endif
40:
41: /*
42: * Define floating point IEEE compare result values.
43: */
44:
45: typedef enum {
46: _FpCompareEqual,
47: _FpCompareGreater,
48: _FpCompareLess,
49: _FpCompareUnordered
50: } _FPIEEE_COMPARE_RESULT;
51:
52: /*
53: * Define floating point format and result precision values.
54: */
55:
56: typedef enum {
57: _FpFormatFp32,
58: _FpFormatFp64,
59: _FpFormatFp80,
60: _FpFormatFp128,
61: _FpFormatI16,
62: _FpFormatI32,
63: _FpFormatI64,
64: _FpFormatU16,
65: _FpFormatU32,
66: _FpFormatU64,
67: _FpFormatBcd80,
68: _FpFormatCompare,
69: _FpFormatString
70: } _FPIEEE_FORMAT;
71:
72: /*
73: * Define operation code values.
74: */
75:
76: typedef enum {
77: _FpCodeUnspecified,
78: _FpCodeAdd,
79: _FpCodeSubtract,
80: _FpCodeMultiply,
81: _FpCodeDivide,
82: _FpCodeSquareRoot,
83: _FpCodeRemainder,
84: _FpCodeCompare,
85: _FpCodeConvert,
86: _FpCodeRound,
87: _FpCodeTruncate,
88: _FpCodeFloor,
89: _FpCodeCeil,
90: _FpCodeAcos,
91: _FpCodeAsin,
92: _FpCodeAtan,
93: _FpCodeAtan2,
94: _FpCodeCabs,
95: _FpCodeCos,
96: _FpCodeCosh,
97: _FpCodeExp,
98: _FpCodeFabs,
99: _FpCodeFmod,
100: _FpCodeFrexp,
101: _FpCodeHypot,
102: _FpCodeLdexp,
103: _FpCodeLog,
104: _FpCodeLog10,
105: _FpCodeModf,
106: _FpCodePow,
107: _FpCodeSin,
108: _FpCodeSinh,
109: _FpCodeTan,
110: _FpCodeTanh,
111: _FpCodeY0,
112: _FpCodeY1,
113: _FpCodeYn,
114: _FpCodeLogb,
115: _FpCodeNextafter,
116: _FpCodeNegate
117:
118: } _FP_OPERATION_CODE;
119:
120:
121:
122:
123:
124: /*
125: * Define rounding modes.
126: */
127:
128: typedef enum {
129: _FpRoundNearest,
130: _FpRoundMinusInfinity,
131: _FpRoundPlusInfinity,
132: _FpRoundChopped
133: } _FPIEEE_ROUNDING_MODE;
134:
135: typedef enum {
136: _FpPrecisionFull,
137: _FpPrecision53,
138: _FpPrecision24
139: } _FPIEEE_PRECISION;
140:
141:
142: /*
143: * Define floating point context record
144: */
145:
146: typedef float _FP32;
147: typedef double _FP64;
148: typedef short _I16;
149: typedef int _I32;
150: typedef unsigned short _U16;
151: typedef unsigned int _U32;
152:
153:
154: typedef struct {
155: unsigned short W[5];
156: } _FP80;
157:
158: typedef struct {
159: unsigned long W[4];
160: } _FP128;
161:
162: typedef struct {
163: unsigned long W[2];
164: } _I64;
165:
166: typedef struct {
167: unsigned long W[2];
168: } _U64;
169:
170: typedef struct {
171: unsigned short W[5];
172: } _BCD80;
173:
174:
175: typedef struct {
176: union {
177: _FP32 Fp32Value;
178: _FP64 Fp64Value;
179: _FP80 Fp80Value;
180: _FP128 Fp128Value;
181: _I16 I16Value;
182: _I32 I32Value;
183: _I64 I64Value;
184: _U16 U16Value;
185: _U32 U32Value;
186: _U64 U64Value;
187: _BCD80 Bcd80Value;
188: char *StringValue;
189: int CompareValue;
190: } Value;
191:
192: unsigned int OperandValid : 1;
193: unsigned int Format : 4;
194:
195: } _FPIEEE_VALUE;
196:
197:
198: typedef struct {
199: unsigned int Inexact : 1;
200: unsigned int Underflow : 1;
201: unsigned int Overflow : 1;
202: unsigned int ZeroDivide : 1;
203: unsigned int InvalidOperation : 1;
204: } _FPIEEE_EXCEPTION_FLAGS;
205:
206:
207: typedef struct {
208: unsigned int RoundingMode : 2;
209: unsigned int Precision : 3;
210: unsigned int Operation :12;
211: _FPIEEE_EXCEPTION_FLAGS Cause;
212: _FPIEEE_EXCEPTION_FLAGS Enable;
213: _FPIEEE_EXCEPTION_FLAGS Status;
214: _FPIEEE_VALUE Operand1;
215: _FPIEEE_VALUE Operand2;
216: _FPIEEE_VALUE Result;
217: } _FPIEEE_RECORD;
218:
219:
220: struct _EXCEPTION_POINTERS;
221:
222: /*
223: * Floating point IEEE exception filter routine
224: */
225:
226: int _CRTAPI1 _fpieee_flt(unsigned long code,
227: struct _EXCEPTION_POINTERS *p,
228: int handler(_FPIEEE_RECORD *));
229:
230:
231:
232: #ifdef __cplusplus
233: }
234: #endif
235:
236: #define _INC_FPIEEE
237: #endif /* _INC_FPIEEE */
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.