C Language Log () function: Returns an e-base pair value
header file:
The log () function returns an e-base numeric value, which is a prototype:
Log () is used to calculate the pair value of x with an E, and then returns the result. Set the return value to RET, the
If x is negative or 0, an error occurs and the errno value is set. Error code:
EDOM: parameter x is negative;
Erange: Parameter x is zero value, 0 is undefined for value.
Note: Please join-LM when compiling with GCC.
"Instance" to find the logarithm of 5.5.
#include <stdio.h>
#include <math.h>
int main ()
{
double param, result;
param = 5.5;
result = log (param);
printf ("log (%f) =%f\n", param, result);
return 0;
}
Output results:
Log (5.500000) = 1.704748
C language log10 () function: Returns a value of 10
header file:
LOG10 () returns a 10-based numeric value, which is a prototype:
LOG10 () is used to calculate the pair value of a 10-based x, and then returns the result. Set the return value to RET, the
Return value: Returns the numeric value of the argument x with a 10 base.
If x is negative or 0, an error occurs and the errno value is set. Error code:
EDOM: parameter x is negative;
Erange: Parameter x is zero value, 0 is undefined for value.
Note: Please join-LM when compiling with GCC.
Instance
#include <math.h>
Main () {
double answer;
Answer = log10 (MB);
printf ("log10" =%f\n ", answer);
}
Output results: