FETESTEXCEPT(3POSIX)
π fetestexcept β bestie, let's check those floating-point exception flags π
okay so real quick before we dive in: this is part of the POSIX Programmer's Manual. The Linux implementation of this interface may differ (so go peek at the corresponding Linux manual page for the tea on Linux behavior), or honestly the interface may just not be implemented on Linux at all. π
β¨ PROLOG β¨
This manual page is part of the POSIX Programmer's Manual. The Linux implementation of this interface may differ β consult the corresponding Linux manual page for details of Linux behavior β or the interface may not be implemented on Linux. either way, girl, check your platform π
πΈ NAME πΈ
fetestexcept β test floating-point exception flags π
π¦ SYNOPSIS π¦
#include <fenv.h>
int fetestexcept(int excepts);
π DESCRIPTION π
The functionality described on this reference page is aligned with the ISO C standard. Any conflict between the requirements described here and the ISO C standard is unintentional. This volume of POSIX.1β2017 defers to the ISO C standard. no cap.
So what does fetestexcept() actually do? She determines which of a specified subset of the floating-point exception flags are currently set. The excepts argument specifies the floating-point status flags to be queried. that's it, that's the whole vibe check π₯
π RETURN VALUE π
fetestexcept() shall return the value of the bitwise-inclusive OR of the floating-point exception macros corresponding to the currently set floating-point exceptions included in excepts. iconic behavior fr fr β¨
π ERRORS π
No errors are defined. literally none. she's unproblematic π
The following sections are informative.
π EXAMPLES π
The following example calls function f() if an invalid exception is set, and then function g() if an overflow exception is set:
#include <fenv.h>
/* ... */
{
#pragma STDC FENV_ACCESS ON
int set_excepts;
feclearexcept(FE_INVALID | FE_OVERFLOW);
// maybe raise exceptions
set_excepts = fetestexcept(FE_INVALID | FE_OVERFLOW);
if (set_excepts & FE_INVALID) f();
if (set_excepts & FE_OVERFLOW) g();
/* ... */
}
look at her go π«Ά
π§ APPLICATION USAGE π§
None. (yes, really, nothing to add, she said what she said π )
π RATIONALE π
None. π
β FUTURE DIRECTIONS β
None. πΈ
π SEE ALSO π
feclearexcept()fegetexceptflag()feraiseexcept()
Also, from the Base Definitions volume of POSIX.1β2017: <fenv.h> π¦
π COPYRIGHT π
Portions of this text are reprinted and reproduced in electronic form from IEEE Std 1003.1-2017, Standard for Information Technology -- Portable Operating System Interface (POSIX), The Open Group Base Specifications Issue 7, 2018 Edition, Copyright (C) 2018 by the Institute of Electrical and Electronics Engineers, Inc and The Open Group.
In the event of any discrepancy between this version and the original IEEE and The Open Group Standard, the original IEEE and The Open Group Standard is the referee document. The original Standard can be obtained online at http://www.opengroup.org/unix/online.html .
Any typographical or formatting errors that appear in this page are most likely to have been introduced during the conversion of the source files to man page format. To report such errors, see https://www.kernel.org/doc/man-pages/reporting_bugs.html . (not me being the messenger tho π)
and that's the whole page, bestie!! this lil masterpiece came from IEEE/The Open Group, dated 2017, and lives under the name FETESTEXCEPT(3POSIX) β go forth and test those exception flags, you absolute main character ππ
π¦ where this page comes from
- debian bookworm: manpages-posix-dev 2017a-2 Β· Other
- debian trixie: manpages-posix-dev 2017a-2 Β· Other
- ubuntu jammy: manpages-posix-dev 2017a-2 Β· Other
- ubuntu noble: manpages-posix-dev 2017a-2 Β· Other
- ubuntu resolute: manpages-posix-dev 2017a-2build1 Β· Other
- ubuntu stonking: manpages-posix-dev 2017a-2.1 Β· Other
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms