The frexp() function breaks the floating point number x into its binary significand i., e., floating point with an absolute value between [0.5, 1.0) and an integral exponent for 2.
x = significand * (2^exponent).
It used to :
1. It is used to find significand which is always between 0.5 and 1.0 2. It is used to find exponent which is power of 2.
double frexp (double x); float frexp (float x); long double frexp (long double x);
- The frexp() function takes a single argument.
- The frexp() function returns the binary significand whose absolute value lies in the interval [0.5, 1).
- If x is zero, both significand and exponent are zero.
Error and Exception:
- It is mandatory to give both the arguments otherwise it will give error no matching function for call to ‘frexp()’.
- If we pass a string as an argument we will get an error no matching function for call to ‘frexp(const char [n]).
- If x=0 then significand is zero and exponent is zero
- x >= 1 then significand is positive number and exponent is positive number
- x <= -1 then significand is negative number and exponent is positive number
- -1 < x < 0 then significand is negative number and exponent is negative number
- 0 < x < 1 then significand is positive number and exponent is negative number
# CODE 1
5.35 = 0.66875 * 2^3
# CODE 2
5 = 0.625 * 2^3
- Difference between Private and Protected in C++ with Example
- Difference between Inheritance and Polymorphism
- Difference between Single and Multiple Inheritance in C++
- Difference between Abstraction and Encapsulation in C++
- return statement in C/C++ with Examples
- How to implement our own Vector Class in C++?
- Web Programming in C++
- C++ Program to print an Array using Recursion
- Storage Classes in C++ with Examples
- fill_n() function in C++ STL with examples
- fill() function in C++ STL with examples
- How to erase an element from a vector using erase() and reverse_iterator?
- iomanip setbase() function in C++ with Examples
- iomanip setpricision() function in C++ with Examples
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.