1FETESTEXCEPT(P) POSIX Programmer's Manual FETESTEXCEPT(P)
2
3
4
6 fetestexcept - test floating-point exception flags
7
9 #include <fenv.h>
10
11 int fetestexcept(int excepts);
12
13
15 The fetestexcept() function shall determine which of a specified subset
16 of the floating-point exception flags are currently set. The excepts
17 argument specifies the floating-point status flags to be queried.
18
20 The fetestexcept() function shall return the value of the bitwise-
21 inclusive OR of the floating-point exception macros corresponding to
22 the currently set floating-point exceptions included in excepts.
23
25 No errors are defined.
26
27 The following sections are informative.
28
30 The following example calls function f() if an invalid exception is
31 set, and then function g() if an overflow exception is set:
32
33
34 #include <fenv.h>
35 /* ... */
36 {
37 #pragma STDC FENV_ACCESS ON
38 int set_excepts;
39 feclearexcept(FE_INVALID | FE_OVERFLOW);
40 // maybe raise exceptions
41 set_excepts = fetestexcept(FE_INVALID | FE_OVERFLOW);
42 if (set_excepts & FE_INVALID) f();
43 if (set_excepts & FE_OVERFLOW) g();
44 /* ... */
45 }
46
48 None.
49
51 None.
52
54 None.
55
57 feclearexcept() , fegetexceptflag() , feraiseexcept() , the Base Defi‐
58 nitions volume of IEEE Std 1003.1-2001, <fenv.h>
59
61 Portions of this text are reprinted and reproduced in electronic form
62 from IEEE Std 1003.1, 2003 Edition, Standard for Information Technology
63 -- Portable Operating System Interface (POSIX), The Open Group Base
64 Specifications Issue 6, Copyright (C) 2001-2003 by the Institute of
65 Electrical and Electronics Engineers, Inc and The Open Group. In the
66 event of any discrepancy between this version and the original IEEE and
67 The Open Group Standard, the original IEEE and The Open Group Standard
68 is the referee document. The original Standard can be obtained online
69 at http://www.opengroup.org/unix/online.html .
70
71
72
73IEEE/The Open Group 2003 FETESTEXCEPT(P)