5 For now, support only for the basic abstraction of flags that are
6 either set or clear. fexcept_t could be structure that holds more info
7 about the fp environment.
9 typedef unsigned short fexcept_t
;
11 /* This 28-byte struct represents the entire floating point
12 environment as stored by fnstenv or fstenv */
15 unsigned short __control_word
;
16 unsigned short __unused0
;
17 unsigned short __status_word
;
18 unsigned short __unused1
;
19 unsigned short __tag_word
;
20 unsigned short __unused2
;
21 unsigned int __ip_offset
; /* instruction pointer offset */
22 unsigned short __ip_selector
;
23 unsigned short __opcode
;
24 unsigned int __data_offset
;
25 unsigned short __data_selector
;
26 unsigned short __unused3
;
30 /* FPU status word exception flags */
31 #define FE_INVALID 0x01
32 #define FE_DENORMAL 0x02
33 #define FE_DIVBYZERO 0x04
34 #define FE_OVERFLOW 0x08
35 #define FE_UNDERFLOW 0x10
36 #define FE_INEXACT 0x20
37 #define FE_ALL_EXCEPT (FE_INVALID | FE_DENORMAL | FE_DIVBYZERO \
38 | FE_OVERFLOW | FE_UNDERFLOW | FE_INEXACT)
40 /* FPU control word rounding flags */
41 #define FE_TONEAREST 0x0000
42 #define FE_DOWNWARD 0x0400
43 #define FE_UPWARD 0x0800
44 #define FE_TOWARDZERO 0x0c00
47 /* The default floating point environment */
48 #define FE_DFL_ENV ((const fenv_t *)-1)
57 /*TODO: Some of these could be inlined */
60 extern int feclearexcept (int);
61 extern int fegetexceptflag (fexcept_t
* flagp
, int excepts
);
62 extern int feraiseexcept (int excepts
);
63 extern int fesetexceptflag (const fexcept_t
*, int);
64 extern int fetestexcept (int excepts
);
69 extern int fegetround (void);
70 extern int fesetround (int mode
);
73 /* 7.6.4 Environment */
75 extern int fegetenv (fenv_t
* envp
);
76 extern int fesetenv (const fenv_t
* );
77 extern int feupdateenv (const fenv_t
*);
78 extern int feholdexcept (fenv_t
*);
83 #endif /* Not RC_INVOKED */
85 #endif /* ndef _FENV_H */