1FETESTEXCEPT(3P) POSIX Programmer's Manual FETESTEXCEPT(3P)
2
3
4
6 This manual page is part of the POSIX Programmer's Manual. The Linux
7 implementation of this interface may differ (consult the corresponding
8 Linux manual page for details of Linux behavior), or the interface may
9 not be implemented on Linux.
10
12 fetestexcept — test floating-point exception flags
13
15 #include <fenv.h>
16
17 int fetestexcept(int excepts);
18
20 The functionality described on this reference page is aligned with the
21 ISO C standard. Any conflict between the requirements described here
22 and the ISO C standard is unintentional. This volume of POSIX.1‐2017
23 defers to the ISO C standard.
24
25 The fetestexcept() function shall determine which of a specified subset
26 of the floating-point exception flags are currently set. The excepts
27 argument specifies the floating-point status flags to be queried.
28
30 The fetestexcept() function shall return the value of the bitwise-
31 inclusive OR of the floating-point exception macros corresponding to
32 the currently set floating-point exceptions included in excepts.
33
35 No errors are defined.
36
37 The following sections are informative.
38
40 The following example calls function f() if an invalid exception is
41 set, and then function g() if an overflow exception is set:
42
43
44 #include <fenv.h>
45 /* ... */
46 {
47 #pragma STDC FENV_ACCESS ON
48 int set_excepts;
49 feclearexcept(FE_INVALID | FE_OVERFLOW);
50 // maybe raise exceptions
51 set_excepts = fetestexcept(FE_INVALID | FE_OVERFLOW);
52 if (set_excepts & FE_INVALID) f();
53 if (set_excepts & FE_OVERFLOW) g();
54 /* ... */
55 }
56
58 None.
59
61 None.
62
64 None.
65
67 feclearexcept(), fegetexceptflag(), feraiseexcept()
68
69 The Base Definitions volume of POSIX.1‐2017, <fenv.h>
70
72 Portions of this text are reprinted and reproduced in electronic form
73 from IEEE Std 1003.1-2017, Standard for Information Technology -- Por‐
74 table Operating System Interface (POSIX), The Open Group Base Specifi‐
75 cations Issue 7, 2018 Edition, Copyright (C) 2018 by the Institute of
76 Electrical and Electronics Engineers, Inc and The Open Group. In the
77 event of any discrepancy between this version and the original IEEE and
78 The Open Group Standard, the original IEEE and The Open Group Standard
79 is the referee document. The original Standard can be obtained online
80 at http://www.opengroup.org/unix/online.html .
81
82 Any typographical or formatting errors that appear in this page are
83 most likely to have been introduced during the conversion of the source
84 files to man page format. To report such errors, see https://www.ker‐
85 nel.org/doc/man-pages/reporting_bugs.html .
86
87
88
89IEEE/The Open Group 2017 FETESTEXCEPT(3P)