The feholdexcept() function in C/C++ first saves the current floating-point environment in the object of fenv_t and it then resets the current values of all the floating point status flags. The feholdexcept() function is defined in cfenv header file in C++ and in fenv.h header file in C.
int feholdexcept( fenv_t* envp )
Parameters: The function accepts a single mandatory parameter envp which is a pointer to an object
of type fenv_t that stores the current status of the floating point environment.
Return Value: The function returns a int value on two conditions:
- If function completed succesfully it returns 0.
- On failure, it returns a nonzero integer.
Below programs illustrate the above function.
x/y = inf No exceptions raised
Exceptions raised are : FE_DIVBYZERO Exceptions raised are : No exception found Exceptions raised are : FE_DIVBYZERO
- time.h header file in C with Examples
- C++ program to compare two Strings using Operator Overloading
- not1 and not2 function templates in C++ STL with Examples
- Go vs C++
- Trie Data Structure using smart pointer and OOP in C++
- std::hash class in C++ STL
- History of C++
- What are Forward declarations in C++
- __builtin_inf() functions of GCC compiler
- Structures in C++
- Variables in C++
- Implementing Forward Iterator in BST
- Count substrings that contain all vowels | SET 2
- Machine Learning in 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 email@example.com. 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