C language exp () function: The second power function of E (the x-th square value at the end of E)
header file:
EXP () is used to calculate the X-square value, the ex value, at the base of E, and then return the result. Its prototype is:
return value returns the X-square calculation of E.
Note that when compiling with GCC, please join-LM.
"Instance" calculates the value of the 10-second side of E.
#include <math.h>
Main () {
double answer;
Answer = exp (ten);
printf ("e^10 =%f\n", answer);
}
Run Result:
C language Ldexp () function: Returns the value of the exp second square on x multiplied by 2
header file:
Ldexp () is used to find the value of the exp second side of a number multiplied by 2, and the prototype is:
Double Ldexp (double x, int exp);
"Parameter" x is the mantissa, and exp is the power number.
Set the return value to RET, then ret = x * 2exp
Return value returns the RET.
Note that when compiling with GCC, please join-LM.
The "example" computes the value of 3* (2^2).
#include <math.h>
Main () {
int exp;
Double x, answer;
Answer = LDEXP (3, 2);
printf ("3*2^ (2) =%f\n", answer);
}
Operation Result:
C language Frexp () function: To decompose a floating-point number into mantissa and exponent
header file:
Frexp () is used to decompose a number into mantissa and exponent, and its prototype is:
Double Frexp (double x, int *exp);
"Parameter" x is a floating-point number to be decomposed, and exp is a pointer to the storage index.
Set the return value to RET, then x = ret * 2exp, where exp is an integer, and the absolute value of the RET is between 0.5 (inclusive) and 1 (not included).
If x = 0, then ret = exp = 0
Return value returns the MANTISSA ret.
Note that when compiling with GCC, please join-LM.
Take a look at the following code:
#include <stdio.h> /* printf
/#include <math.h> /* frexp
/int main ()
{
double param, result;
int n;
param = 8.0;
result = Frexp (param, &n);
printf ("%f =%f * 2^%d\n", param, result, n);
return 0;
}
Output results:
8.000000 = 0.500000 * 2^4
To change the value of line 7th param to 242.354, the output is:
242.354000 = 0.946695 * 2^8