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