std::fegete...td::fesetenv(3)

πŸ“¦ version 2024.07.05, in nixpkgs unstable, opensuse-leap 16.0

Okay bestie, welcome to the C++ Standard Libary page for std::fegetenv and std::fesetenv β€” the floating-point environment twins that live under the header your terminal probably truncates to std::fegete...td::fesetenv(3). We're managing the status of the floating-point environment today, and yes, it's giving low-level C++ realness. πŸ’…βœ¨

✨ NAME ✨

std::fegetenv,std::fesetenv - std::fegetenv,std::fesetenv. Yep, the NAME section is literally the duo saying their own names, and honestly? Iconic. One saves the floating-point environment vibe; one sets it. Periodt. πŸ’–

πŸ¦‹ Synopsis πŸ¦‹

Defined in header <cfenv>.

int fegetenv( std::fenv_t* envp )        (1) (since C++11)
int fesetenv( const std::fenv_t* envp ); (2) (since C++11)

Manages the status of the floating-point environment. No cap.

  1. Attempts to store the status of the floating-point environment in the object pointed to by envp.
  2. Attempts to establish the floating-point environment from the object pointed to by envp. The value of that object must be previously obtained by a call to std::feholdexcept or std::fegetenv or be a floating-point macro constant. If any of the floating-point status flags are set in envp, they become set in the environment (and are then testable with std::fetestexcept), but the corresponding floating-point exceptions are not raised (execution continues uninterrupted).
Bestie, do not just make up an envp value out of nowhere for the second one β€” it has to come from std::feholdexcept, std::fegetenv, or be a floating-point macro constant. That's the rule. 🫢

🫢 Parameters 🫢

  • envp β€” pointer to the object of type std::fenv_t which holds the status of the floating-point environment.

πŸ’– Return value πŸ’–

0 on success, non-zero otherwise. Slay when it's zero, bestie. ✨

πŸ‘€ See also πŸ‘€

  • feholdexcept (C++11) β€” saves the environment, clears all status flags and ignores all future errors (function).
  • feupdateenv (C++11) β€” restores the floating-point environment and raises the previously raised exceptions (function).
  • FE_DFL_ENV (C++11) β€” default floating-point environment (macro constant).
  • C documentation for fegetenv, fesetenv

πŸ’– Source checkpoint, bestie: http://cppreference.com, version 2024.06.10, and the footer page title std::fegete...td::fesetenv(3) β€” that's the whole sign-off tea. πŸ«ΆπŸŽ€

πŸ“¦ where this page comes from