C++ Math frexp()This function breaks the floating point number into the binary significand and an integral exponent. Let the floating point number be x then, x = (significand)*2e where, 'e' is the exponent and 'significand' is the binary significand SyntaxSuppose a floating point number be 'x' and pointer be 'exp': Parameterx: The value which is to be decomposed into the binary significand. exp: It is a pointer to an int, where the value of exponent is stored. Return valueIt returns the binary significand which is the absolute value lies between 0.5(included) and 1(excluded).
Example 1Let's see a simple example when the value of x is greater than 1. Output: Value of x is : 2 2=0.5 * 2^2 In this example, frexp() function calculates the binary significand of a floating point number when the value of x is greater than 1. Example 2Let's see a simple example when the value of x is zero Output: Value of x is : 0 0=0 * 2^0 In this example, frexp() function calculates the binary significand of a floating point number when the value of x is zero. Example 3Let's see a simple example when the value of x lies between 0 and 1. Output: Value of x is : 0.4 0.4=0.8 * 2^-1 In this example, frexp() function calculates the binary significand of a floating point number when the value of x lies between 0 and 1. Example 4Let's see a simple example when the value of x lies between -1 and 0. Output: Value of x is : -0.1 -0.1=-0.8 * 2^-3 In this example, frexp() function calculates the binary significand of a floating point number when the value of x lies between -1 and 0. Example 5Let's see the simple example when the value of x is less than -1. Output: Value of x is : -5 -5=-0.625 * 2^3 In this example, frexp() function calculates the binary significand of a floating point nmber when the value of x is less than -1. Next TopicC++ Math Functions |
We provides tutorials and interview questions of all technology like java tutorial, android, java frameworks
G-13, 2nd Floor, Sec-3, Noida, UP, 201301, India