The feupdateenv() function in C++ first saves currently raised floating-point exceptions. It restores the floating-point environment from the given fenv_t object and then raises the exceptions which were saved previously.
int feupdateenv( fenv_t* envp )
Parameters: It accepts a single mandatory parameter envp which specifies the pointer to the fenv_t object that is set by an earlier call to feholdexcept or fegetenv or is equal to FE_DFL_ENV. The function also accepts a pointer of type fenv_t as its argument which holds a floating point environment previously set by using feholdexcept or fegetenv and restores that floating point environment along with the current environment.
Return Value: The function returns two kinds of value described below:
- It returns zero on success
- It returns non-zero value on failure
Below programs illustrate the above function.
log(0.0): -inf no exceptions raised
log(10.0): 2.302585 exceptions raised
Attention reader! Don’t stop learning now. Get hold of all the important DSA concepts with the DSA Self Paced Course at a student-friendly price and become industry ready.
- Difference between user defined function and library function in C/C++
- How to call some function before main() function in C++?
- Function Overloading vs Function Overriding in C++
- How to call function within function in C or C++
- What happens when a virtual function is called inside a non-virtual function in C++
- Difference between Virtual function and Pure virtual function in C++
- div() function in C++
- fma() function in C++
- exp() function C++
- log() function in C++
- arc function in C
- Inline function in C
- putchar() function in C
- mbsinit() Function in C/C++
- bit_and function in C++
- mbsrtowcs() function in C/C++
- mbrlen() function in C/C++
- wcspbrk() function in C/C++
- wcsrchr() function in C/C++
- mbrtowc() function in C/C++
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.
Improved By : nidhi_biet