STLdoc
STLdocumentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
fpieee.h
Go to the documentation of this file.
1 /***
2 *fpieee.h - Definitions for floating point IEEE exception handling
3 *
4 * Copyright (c) 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 * [Public]
11 *
12 ****/
13 
14 #pragma once
15 #ifndef __midl
16 #ifndef _INC_FPIEEE
17 #define _INC_FPIEEE
18 
19 #if defined (_M_CEE_PURE)
20  #error ERROR: This file is not supported in the pure mode!
21 #else /* defined (_M_CEE_PURE) */
22 
23 #include <crtdefs.h>
24 
25 #ifndef __assembler
26 
27 /*
28  * Currently, all MS C compilers for Win32 platforms default to 8 byte
29  * alignment.
30  */
31 #pragma pack(push,_CRT_PACKING)
32 
33 /* Disable C4324: structure was padded due to __declspec(align()) */
34 #pragma warning(push)
35 #pragma warning(disable: 4324)
36 
37 #ifdef __cplusplus
38 extern "C" {
39 #endif /* __cplusplus */
40 
41 /*
42  * Define floating point IEEE compare result values.
43  */
44 
45 typedef enum {
51 
52 /*
53  * Define floating point format and result precision values.
54  */
55 
56 typedef enum {
71 
72 /*
73  * Define operation code values.
74  */
75 
76 typedef enum {
117  _FpCodeFmin, /* XMMI */
118  _FpCodeFmax, /* XMMI */
120  _XMMIAddps, /* XMMI */
144  _XMMIAddsubps, /* XMMI for PNI */
145  _XMMIHaddps, /* XMMI for PNI */
146  _XMMIHsubps, /* XMMI for PNI */
147  _XMMIRoundps, /* 66 0F 3A 08 */
148  _XMMIRoundss, /* 66 0F 3A 0A */
149  _XMMIDpps, /* 66 0F 3A 40 */
150  _XMMI2Addpd, /* XMMI2 */
168  _XMMI2Cvtpd2pi, /* 66 2D */
169  _XMMI2Cvtsd2si, /* F2 */
170  _XMMI2Cvttpd2pi, /* 66 2C */
171  _XMMI2Cvttsd2si, /* F2 */
172  _XMMI2Cvtps2pd, /* 0F 5A */
173  _XMMI2Cvtss2sd, /* F3 */
174  _XMMI2Cvtpd2ps, /* 66 */
175  _XMMI2Cvtsd2ss, /* F2 */
176  _XMMI2Cvtdq2ps, /* 0F 5B */
177  _XMMI2Cvttps2dq, /* F3 */
178  _XMMI2Cvtps2dq, /* 66 */
179  _XMMI2Cvttpd2dq, /* 66 0F E6 */
180  _XMMI2Cvtpd2dq, /* F2 */
181  _XMMI2Addsubpd, /* 66 0F D0 */
182  _XMMI2Haddpd, /* 66 0F 7C */
183  _XMMI2Hsubpd, /* 66 0F 7D */
184  _XMMI2Roundpd, /* 66 0F 3A 09 */
185  _XMMI2Roundsd, /* 66 0F 3A 0B */
186  _XMMI2Dppd, /* 66 0F 3A 41 */
188 
189 #endif /* __assembler */
190 
191 #ifdef _CRTBLD
192 #ifndef __assembler
193 
194 #define OP_UNSPEC _FpCodeUnspecified
195 #define OP_ADD _FpCodeAdd
196 #define OP_SUB _FpCodeSubtract
197 #define OP_MUL _FpCodeMultiply
198 #define OP_DIV _FpCodeDivide
199 #define OP_REM _FpCodeRemainder
200 #define OP_COMP _FpCodeCompare
201 #define OP_CVT _FpCodeConvert
202 #define OP_RND _FpCodeRound
203 #define OP_TRUNC _FpCodeTruncate
204 
205 #define OP_EXP _FpCodeExp
206 
207 #define OP_POW _FpCodePow
208 #define OP_LOG _FpCodeLog
209 #define OP_LOG10 _FpCodeLog10
210 #define OP_SINH _FpCodeSinh
211 #define OP_COSH _FpCodeCosh
212 #define OP_TANH _FpCodeTanh
213 #define OP_ASIN _FpCodeAsin
214 #define OP_ACOS _FpCodeAcos
215 #define OP_ATAN _FpCodeAtan
216 #define OP_ATAN2 _FpCodeAtan2
217 #define OP_SQRT _FpCodeSquareRoot
218 #define OP_SIN _FpCodeSin
219 #define OP_COS _FpCodeCos
220 #define OP_TAN _FpCodeTan
221 #define OP_CEIL _FpCodeCeil
222 #define OP_FLOOR _FpCodeFloor
223 #define OP_ABS _FpCodeFabs
224 #define OP_MODF _FpCodeModf
225 #define OP_LDEXP _FpCodeLdexp
226 #define OP_CABS _FpCodeCabs
227 #define OP_HYPOT _FpCodeHypot
228 #define OP_FMOD _FpCodeFmod
229 #define OP_FREXP _FpCodeFrexp
230 #define OP_Y0 _FpCodeY0
231 #define OP_Y1 _FpCodeY1
232 #define OP_YN _FpCodeYn
233 
234 #define OP_LOGB _FpCodeLogb
235 #define OP_NEXTAFTER _FpCodeNextafter
236 
237 /* XMMI */
238 #define OP_ADDPS _XMMIAddps
239 #define OP_ADDSS _XMMIAddss
240 #define OP_SUBPS _XMMISubps
241 #define OP_SUBSS _XMMISubss
242 #define OP_MULPS _XMMIMulps
243 #define OP_MULSS _XMMIMulss
244 #define OP_DIVPS _XMMIDivps
245 #define OP_DIVSS _XMMIDivss
246 #define OP_SQRTPS _XMMISqrtps
247 #define OP_SQRTSS _XMMISqrtss
248 #define OP_MAXPS _XMMIMaxps
249 #define OP_MAXSS _XMMIMaxss
250 #define OP_MINPS _XMMIMinps
251 #define OP_MINSS _XMMIMinss
252 #define OP_CMPPS _XMMICmpps
253 #define OP_CMPSS _XMMICmpss
254 #define OP_COMISS _XMMIComiss
255 #define OP_UCOMISS _XMMIUComiss
256 #define OP_CVTPI2PS _XMMICvtpi2ps
257 #define OP_CVTSI2SS _XMMICvtsi2ss
258 #define OP_CVTPS2PI _XMMICvtps2pi
259 #define OP_CVTSS2SI _XMMICvtss2si
260 #define OP_CVTTPS2PI _XMMICvttps2pi
261 #define OP_CVTTSS2SI _XMMICvttss2si
262 #define OP_ADDSUBPS _XMMIAddsubps
263 #define OP_HADDPS _XMMIHaddps
264 #define OP_HSUBPS _XMMIHsubps
265 #define OP_ROUNDPS _XMMIRoundps
266 #define OP_ROUNDSS _XMMIRoundss
267 #define OP_DPPS _XMMIDpps
268 /* XMMI */
269 
270 /* XMMI2 */
271 #define OP_ADDPD _XMMI2Addpd /* XMMI2 */
272 #define OP_ADDSD _XMMI2Addsd
273 #define OP_SUBPD _XMMI2Subpd
274 #define OP_SUBSD _XMMI2Subsd
275 #define OP_MULPD _XMMI2Mulpd
276 #define OP_MULSD _XMMI2Mulsd
277 #define OP_DIVPD _XMMI2Divpd
278 #define OP_DIVSD _XMMI2Divsd
279 #define OP_SQRTPD _XMMI2Sqrtpd
280 #define OP_SQRTSD _XMMI2Sqrtsd
281 #define OP_MAXPD _XMMI2Maxpd
282 #define OP_MAXSD _XMMI2Maxsd
283 #define OP_MINPD _XMMI2Minpd
284 #define OP_MINSD _XMMI2Minsd
285 #define OP_CMPPD _XMMI2Cmppd
286 #define OP_CMPSD _XMMI2Cmpsd
287 #define OP_COMISD _XMMI2Comisd
288 #define OP_UCOMISD _XMMI2UComisd
289 #define OP_CVTPD2PI _XMMI2Cvtpd2pi /* 66 2D */
290 #define OP_CVTSD2SI _XMMI2Cvtsd2si /* F2 */
291 #define OP_CVTTPD2PI _XMMI2Cvttpd2pi /* 66 2C */
292 #define OP_CVTTSD2SI _XMMI2Cvttsd2si /* F2 */
293 #define OP_CVTPS2PD _XMMI2Cvtps2pd /* 0F 5A */
294 #define OP_CVTSS2SD _XMMI2Cvtss2sd /* F3 */
295 #define OP_CVTPD2PS _XMMI2Cvtpd2ps /* 66 */
296 #define OP_CVTSD2SS _XMMI2Cvtsd2ss /* F2 */
297 #define OP_CVTDQ2PS _XMMI2Cvtdq2ps /* 0F 5B */
298 #define OP_CVTTPS2DQ _XMMI2Cvttps2dq /* F3 */
299 #define OP_CVTPS2DQ _XMMI2Cvtps2dq /* 66 */
300 #define OP_CVTTPD2DQ _XMMI2Cvttpd2dq /* 66 0F E6 */
301 #define OP_CVTPD2DQ _XMMI2Cvtpd2dq /* F2 */
302 #define OP_ADDSUBPD _XMMI2Addsubpd /* 66 0F D0 */
303 #define OP_HADDPD _XMMI2Haddpd /* 66 0F 7C */
304 #define OP_HSUBPD _XMMI2Hsubpd /* 66 0F 7D */
305 #define OP_ROUNDPD _XMMI2Roundpd /* 66 0F 3A 09 */
306 #define OP_ROUNDSD _XMMI2Roundsd /* 66 0F 3A 0B */
307 #define OP_DPPD _XMMI2Dppd /* 66 0F 3A 41 */
308 /* XMMI2 */
309 
310 #else /* __assembler */
311 
312 /* This must be the same as the enumerator _FP_OPERATION_CODE ! */
313 #define OP_UNSPEC 0
314 #define OP_ADD 1
315 #define OP_SUB 2
316 #define OP_MUL 3
317 #define OP_DIV 4
318 #define OP_SQRT 5
319 #define OP_REM 6
320 #define OP_COMP 7
321 #define OP_CVT 8
322 #define OP_RND 9
323 #define OP_TRUNC 10
324 #define OP_FLOOR 11
325 #define OP_CEIL 12
326 #define OP_ACOS 13
327 #define OP_ASIN 14
328 #define OP_ATAN 15
329 #define OP_ATAN2 16
330 #define OP_CABS 17
331 #define OP_COS 18
332 #define OP_COSH 19
333 #define OP_EXP 20
334 #define OP_ABS 21 /* same as OP_FABS */
335 #define OP_FABS 21 /* same as OP_ABS */
336 #define OP_FMOD 22
337 #define OP_FREXP 23
338 #define OP_HYPOT 24
339 #define OP_LDEXP 25
340 #define OP_LOG 26
341 #define OP_LOG10 27
342 #define OP_MODF 28
343 #define OP_POW 29
344 #define OP_SIN 30
345 #define OP_SINH 31
346 #define OP_TAN 32
347 #define OP_TANH 33
348 #define OP_Y0 34
349 #define OP_Y1 35
350 #define OP_YN 36
351 #define OP_LOGB 37
352 #define OP_NEXTAFTER 38
353 #define OP_NEG 39
354 
355 #endif /* __assembler */
356 #endif /* _CRTBLD */
357 
358 /*
359  * Define rounding modes.
360  */
361 
362 #ifndef __assembler
363 
364 typedef enum {
370 
371 typedef enum {
376 
377 
378 /*
379  * Define floating point context record
380  */
381 
382 typedef float _FP32;
383 typedef double _FP64;
384 typedef short _I16;
385 typedef int _I32;
386 typedef unsigned short _U16;
387 typedef unsigned int _U32;
388 typedef __int64 _Q64;
389 
390 #ifdef _CRTBLD
391 typedef struct {
392  unsigned long W[4];
393 } _U32ARRAY;
394 #endif /* _CRTBLD */
395 
396 typedef struct
397 {
398  unsigned short W[5];
399 } _FP80;
400 
401 typedef struct _CRT_ALIGN(16)
402 {
403  unsigned long W[4];
405 
406 typedef struct _CRT_ALIGN(8)
407 {
408  unsigned long W[2];
410 
411 typedef struct _CRT_ALIGN(8)
412 {
413  unsigned long W[2];
415 
416 typedef struct
417 {
418  unsigned short W[5];
419 } _BCD80;
420 
421 typedef struct _CRT_ALIGN(16)
422 {
423  _Q64 W[2];
425 
426 typedef struct {
427  union {
428  _FP32 Fp32Value;
429  _FP64 Fp64Value;
432  _I16 I16Value;
433  _I32 I32Value;
435  _U16 U16Value;
436  _U32 U32Value;
439  char *StringValue;
441 #ifdef _CRTBLD
442  _U32ARRAY U32ArrayValue;
443 #endif /* _CRTBLD */
444  _Q64 Q64Value;
446  } Value;
447 
448  unsigned int OperandValid : 1;
449  unsigned int Format : 4;
450 
451 } _FPIEEE_VALUE;
452 
453 
454 typedef struct {
455  unsigned int Inexact : 1;
456  unsigned int Underflow : 1;
457  unsigned int Overflow : 1;
458  unsigned int ZeroDivide : 1;
459  unsigned int InvalidOperation : 1;
461 
462 
463 typedef struct {
464  unsigned int RoundingMode : 2;
465  unsigned int Precision : 3;
466  unsigned int Operation :12;
474 
475 
476 struct _EXCEPTION_POINTERS;
477 
478 /*
479  * Floating point IEEE exception filter routine
480  */
481 
482 _CRTIMP int __cdecl _fpieee_flt(
483  _In_ unsigned long _ExceptionCode,
484  _In_ struct _EXCEPTION_POINTERS * _PtExceptionPtr,
485  _In_ int (__cdecl * _Handler)(_FPIEEE_RECORD *)
486  );
487 
488 #ifdef __cplusplus
489 }
490 #endif /* __cplusplus */
491 
492 #pragma warning(pop)
493 #pragma pack(pop)
494 #endif /* __assembler */
495 
496 #endif /* defined (_M_CEE_PURE) */
497 
498 #endif /* _INC_FPIEEE */
499 #endif /* __midl */
_FP32 Fp32Value
Definition: fpieee.h:428
_I64
Definition: fpieee.h:409
_FP_OPERATION_CODE
Definition: fpieee.h:76
Definition: fpieee.h:186
Definition: fpieee.h:108
Definition: fpieee.h:61
_FPIEEE_FORMAT
Definition: fpieee.h:56
Definition: fpieee.h:146
Definition: fpieee.h:151
Definition: fpieee.h:182
_FPIEEE_ROUNDING_MODE
Definition: fpieee.h:364
Definition: fpieee.h:99
_CRTIMP int __cdecl _fpieee_flt(_In_ unsigned long _ExceptionCode, _In_ struct _EXCEPTION_POINTERS *_PtExceptionPtr, _In_ int(__cdecl *_Handler)(_FPIEEE_RECORD *))
Definition: fpieee.h:80
Definition: fpieee.h:164
Definition: fpieee.h:180
Definition: fpieee.h:368
Definition: fpieee.h:153
Definition: fpieee.h:169
Definition: fpieee.h:117
Definition: fpieee.h:120
Definition: fpieee.h:97
_FP80 Fp80Value
Definition: fpieee.h:430
Definition: fpieee.h:162
Definition: fpieee.h:125
#define _CRTIMP
Definition: crtdefs.h:23
Definition: fpieee.h:83
Definition: fpieee.h:64
Definition: fpieee.h:90
Definition: fpieee.h:161
Definition: fpieee.h:160
Definition: fpieee.h:154
Definition: fpieee.h:100
Definition: fpieee.h:165
Definition: fpieee.h:416
Definition: fpieee.h:365
Definition: fpieee.h:59
_U16 U16Value
Definition: fpieee.h:435
Definition: fpieee.h:170
Definition: fpieee.h:57
Definition: fpieee.h:46
Definition: fpieee.h:168
_FPQ64 Fpq64Value
Definition: fpieee.h:445
_FPIEEE_EXCEPTION_FLAGS Cause
Definition: fpieee.h:467
Definition: fpieee.h:181
Definition: fpieee.h:128
Definition: fpieee.h:82
Definition: fpieee.h:67
Definition: fpieee.h:121
Definition: fpieee.h:77
Definition: fpieee.h:454
Definition: fpieee.h:141
Definition: fpieee.h:374
Definition: fpieee.h:136
Definition: fpieee.h:94
Definition: fpieee.h:111
Definition: fpieee.h:96
Definition: fpieee.h:173
Definition: fpieee.h:79
Definition: fpieee.h:102
Definition: fpieee.h:65
Definition: fpieee.h:93
Definition: fpieee.h:367
Definition: fpieee.h:124
Definition: fpieee.h:156
Definition: fpieee.h:172
__int64 _Q64
Definition: fpieee.h:388
virtual property T Value
Definition: vccorlib.h:1414
_FPIEEE_PRECISION
Definition: fpieee.h:371
Definition: fpieee.h:463
_FPIEEE_VALUE Operand2
Definition: fpieee.h:471
Definition: fpieee.h:131
Definition: fpieee.h:426
char * StringValue
Definition: fpieee.h:439
Definition: fpieee.h:166
Definition: fpieee.h:66
Definition: fpieee.h:178
_FPIEEE_VALUE Result
Definition: fpieee.h:472
_FPIEEE_EXCEPTION_FLAGS Status
Definition: fpieee.h:469
Definition: fpieee.h:129
Definition: fpieee.h:147
_FP128
Definition: fpieee.h:404
Definition: fpieee.h:112
Definition: fpieee.h:88
Definition: fpieee.h:144
Definition: fpieee.h:138
Definition: fpieee.h:134
Definition: fpieee.h:167
Definition: fpieee.h:157
Definition: fpieee.h:78
Definition: fpieee.h:185
#define _In_
Definition: sal.h:314
Definition: fpieee.h:174
Definition: fpieee.h:98
Definition: fpieee.h:132
Definition: fpieee.h:107
Definition: fpieee.h:109
Definition: fpieee.h:140
_I16 I16Value
Definition: fpieee.h:432
Definition: fpieee.h:84
Definition: fpieee.h:133
Definition: fpieee.h:127
Definition: fpieee.h:110
struct _CRT_ALIGN(16)
Definition: fpieee.h:401
Definition: fpieee.h:104
Definition: fpieee.h:126
Definition: fpieee.h:130
_FP64 Fp64Value
Definition: fpieee.h:429
Definition: fpieee.h:366
Definition: fpieee.h:163
short _I16
Definition: fpieee.h:384
Definition: fpieee.h:60
Definition: fpieee.h:179
Definition: fpieee.h:184
unsigned short _U16
Definition: fpieee.h:386
Definition: fpieee.h:87
Definition: fpieee.h:48
Definition: fpieee.h:106
Definition: fpieee.h:91
Definition: fpieee.h:85
Definition: fpieee.h:150
Definition: fpieee.h:81
Definition: fpieee.h:159
Definition: fpieee.h:115
Definition: fpieee.h:62
Definition: fpieee.h:148
Definition: fpieee.h:372
_FPIEEE_COMPARE_RESULT
Definition: fpieee.h:45
float _FP32
Definition: fpieee.h:382
unsigned int _U32
Definition: fpieee.h:387
_FP128 Fp128Value
Definition: fpieee.h:431
Definition: fpieee.h:105
Definition: fpieee.h:68
Definition: fpieee.h:137
_U32 U32Value
Definition: fpieee.h:436
Definition: fpieee.h:143
Definition: fpieee.h:176
double _FP64
Definition: fpieee.h:383
_U64 U64Value
Definition: fpieee.h:437
_U64
Definition: fpieee.h:414
Definition: fpieee.h:373
Definition: fpieee.h:183
Definition: fpieee.h:145
Definition: fpieee.h:92
Definition: fpieee.h:113
Definition: fpieee.h:135
Definition: fpieee.h:95
Definition: fpieee.h:142
Definition: fpieee.h:396
Definition: fpieee.h:58
int CompareValue
Definition: fpieee.h:440
Definition: fpieee.h:177
Definition: fpieee.h:69
_BCD80 Bcd80Value
Definition: fpieee.h:438
Definition: fpieee.h:118
Definition: fpieee.h:123
struct _FPIEEE_RECORD * _PFPIEEE_RECORD
_FPQ64
Definition: fpieee.h:424
Definition: fpieee.h:175
Definition: fpieee.h:47
Definition: fpieee.h:122
Definition: fpieee.h:114
_FPIEEE_VALUE Operand1
Definition: fpieee.h:470
_I64 I64Value
Definition: fpieee.h:434
Definition: fpieee.h:103
Definition: fpieee.h:89
_Q64 Q64Value
Definition: fpieee.h:444
Definition: fpieee.h:101
Definition: fpieee.h:149
Definition: fpieee.h:63
Definition: fpieee.h:158
Definition: fpieee.h:171
Definition: fpieee.h:116
Definition: fpieee.h:139
Definition: fpieee.h:86
Definition: fpieee.h:119
_I32 I32Value
Definition: fpieee.h:433
int _I32
Definition: fpieee.h:385
Definition: fpieee.h:155
Definition: fpieee.h:49
Definition: fpieee.h:152
_FPIEEE_EXCEPTION_FLAGS Enable
Definition: fpieee.h:468