FEUPDATEENV(3P)

πŸ’– FEUPDATEENV(3P) β€” bestie edition πŸ’–

okay so this one is from the POSIX Programmer's Manual (yes, that whole family of pages), and it's all about feupdateenv. buckle up πŸŽ€


🌸 PROLOG 🌸

ok so real talk first: 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 deets on Linux behavior, bestie), or the interface might not even be implemented on Linux at all. not me being the bearer of bad news πŸ™ˆ


✨ NAME ✨

feupdateenv β€” update floating-point environment


πŸ¦‹ SYNOPSIS πŸ¦‹

#include <fenv.h>

int feupdateenv(const fenv_t *envp);

πŸ’… DESCRIPTION πŸ’…

so the functionality described on this reference page is aligned with the ISO C standard. and if there's any conflict between what's required here and what the ISO C standard says, that conflict is unintentional β€” like, nobody meant it. this volume of POSIX.1‐2017 defers to the ISO C standard. periodt. πŸ‘‘

now the actual tea: the feupdateenv() function shall attempt to save the currently raised floating-point exceptions in its automatic storage, 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.

and the argument envp shall point to an object set by a call to feholdexcept() or fegetenv(), or equal a floating-point environment macro. so basically it's gotta be a legit env, no random pointers, okay? πŸ’€


πŸ”₯ RETURN VALUE πŸ”₯

feupdateenv() shall return a zero value if and only if all the required actions were successfully carried out. zero = slay, non-zero = something went sideways.


🫢 ERRORS 🫢

No errors are defined. iconic, honestly. zero drama.

also, the following sections are informative. (translation: the next few are vibes/context, not hard requirements πŸ’–)


🌈 EXAMPLES 🌈

here's a sample showing how you'd hide spurious underflow floating-point exceptions. look at the code, it's giving clean:

#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. nothing to add, bestie. it's giving minimal.


⭐ RATIONALE ⭐

None. again, nothing. truly unbothered.


🧚 FUTURE DIRECTIONS 🧚

None. no plans, no plot twists, no nothing. πŸ€·β€β™€οΈ


πŸ’œ SEE ALSO πŸ’œ

  • fegetenv()
  • feholdexcept()

and from the Base Definitions volume of POSIX.1‐2017: <fenv.h> 🌸


ok so legally obligated moment, but it matters so here it is fr fr:

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 is the main character here, no cap.)

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 .


and that's the whole page bestie πŸ’– stay safe out there, check your floating-point envs, and remember: save your exceptions before you install the new environment, then raise 'em back. that's the whole plot. πŸ¦‹βœ¨

IEEE/The Open Group β€” 2017 β€” FEUPDATEENV(3P) 🌸 bye bestie, mwah πŸ’…

πŸ“¦ where this page comes from