FEGETENV(3POSIX)

🌸 FEGETENV(3POSIX) β€” the POSIX Programmer's Manual, but make it bestie 🌸

okay so hi!! welcome to the POSIX Programmer's Manual entry for fegetenv and fesetenv, and honestly? these two are the little save-and-load buttons for your floating-point vibes and I'm obsessed. πŸ’–


⚠️ PROLOG (read this first, fr fr)

This manual page is part of the POSIX Programmer's Manual. The Linux implementation of this interface may differ β€” so bestie, go consult the corresponding Linux manual page for details of Linux behavior β€” or the interface may not be implemented on Linux at all. πŸ’€


✨ NAME ✨

fegetenv, fesetenv β€” get and set current floating-point environment


πŸŽ€ SYNOPSIS πŸŽ€

#include <fenv.h>

int fegetenv(fenv_t *envp);
int fesetenv(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 β€” no drama intended, promise. This volume of POSIX.1‐2017 defers to the ISO C standard. periodt.

The fegetenv() function shall attempt to store the current floating-point environment in the object pointed to by envp. it's giving "screenshot your current fp state and save it". πŸ“Έ

The fesetenv() function shall attempt to establish the floating-point environment represented by the object pointed to by envp. The argument envp shall point to an object set by a call to fegetenv() or feholdexcept(), or equal a floating-point environment macro.

🫢 important detail: fesetenv() does not raise floating-point exceptions. it only installs the state of the floating-point status flags represented through its argument. so it's a quiet little glow-up, not a jump scare.

πŸ’… RETURN VALUE πŸ’…

  • If the representation was successfully stored, fegetenv() shall return zero. Otherwise, it shall return a non-zero value.
  • If the environment was successfully established, fesetenv() shall return zero. Otherwise, it shall return a non-zero value.

zero means slay. non-zero means 😭.


πŸ’€ ERRORS πŸ’€

No errors are defined.

The following sections are informative.


πŸ™ˆ EXAMPLES πŸ™ˆ

None.

(not me being handed an empty examples section. iconic behavior honestly.)


🌈 APPLICATION USAGE 🌈

None.


🧚 RATIONALE 🧚

None.


⭐ FUTURE DIRECTIONS ⭐

None.


πŸ”₯ SEE ALSO πŸ”₯

  • feholdexcept()
  • feupdateenv()

The Base Definitions volume of POSIX.1‐2017, <fenv.h>


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 .


and that's the whole page bestie!! brought to you by IEEE/The Open Group, 2017 β€” mwah, take care of your floating-point environment and it'll take care of you πŸ’œβœ¨