FEUPDATEENV(3POSIX)

πŸ’– FEUPDATEENV(3POSIX) β€” the POSIX Programmer's Manual, bestie πŸ’–

okay so this page lives in the POSIX Programmer's Manual and it's all about feupdateenv β€” yes the name is a mouthful, we'll get through it together 🫢

🌸 PROLOG 🌸

okay before anything else, real talk: this manual page is part of the POSIX Programmer's Manual. The Linux implementation of this interface may differ (so like, go check the corresponding Linux manual page for the details on Linux behaviour), or β€” plot twist β€” the interface may not even be implemented on Linux at all. πŸ’€


✨ NAME ✨

feupdateenv β€” update floating-point environment πŸ‘‘

πŸŽ€ SYNOPSIS πŸŽ€

#include <fenv.h>

int feupdateenv(const fenv_t *envp);

πŸ’… 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 β€” like, not on purpose, fr. This volume of POSIX.1‐2017 defers to the ISO C standard.

So what does feupdateenv() actually do? It shall attempt to save the currently raised floating-point exceptions in its automatic storage, then attempt to install the floating-point environment represented by the object pointed to by envp, and then attempt to raise the saved floating-point exceptions. Three steps, one function, main character energy.

The argument envp shall point to an object set by a call to feholdexcept() or fegetenv(), or equal a floating-point environment macro. No random pointers, bestie, it's giving undefined behaviour otherwise. πŸ™ˆ

⭐ RETURN VALUE ⭐

The feupdateenv() function shall return a zero value if and only if all the required actions were successfully carried out. Zero = slay, everything worked. Anything else = it did not. periodt.

πŸ”₯ ERRORS πŸ”₯

No errors are defined.

The following sections are informative.

🌈 EXAMPLES 🌈

Here's a sample of hiding those spurious underflow floating-point exceptions, because they're lowkey embarrassing and we don't need them:

#include <fenv.h>
double f(double x)
{
    #pragma STDC FENV_ACCESS ON
    double result;
    fenv_t save_env;
    feholdexcept(&save_env);
    // compute result
    if (/* test spurious underflow */)
    feclearexcept(FE_UNDERFLOW);
    feupdateenv(&save_env);
    return result;
}

πŸ¦‹ APPLICATION USAGE πŸ¦‹

None. (Yes bestie, that's the whole section. Sometimes the vibe is just... nothing. πŸ’€)

🧚 RATIONALE 🧚

None. (Same energy. Empty. Iconic in its own way.)

πŸ“ FUTURE DIRECTIONS πŸ“

None. (The future is, apparently, holding steady. ✨)

πŸ’œ SEE ALSO πŸ’œ

  • fegetenv()
  • feholdexcept()

And also the Base Definitions volume of POSIX.1‐2017, <fenv.h>. iykyk πŸ“š

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 β€” like, it's the final boss, it wins. 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 .


so yeah, that's the whole page! go forth and update those floating-point environments responsibly, bestie πŸ’–

okay bye, this was brought to you by IEEE/The Open Group, 2017 β€” yeah that's the date and the source, we said it, love that for us. FEUPDATEENV(3POSIX) out. πŸ’…βœ¨