Double-precision floating point (±1.7E±308, ~15 decimal digits)
1st Parameter
The input value for which the natural logarithm is to be computed.
Read more about parameters of log in parameters section
The logfunction in C language Calculates the natural logarithm of the specified number.
The log function computes the natural logarithm (base e) of x. If x is positive, the result is the natural logarithm of x. If x is zero or negative, a domain error occurs, and errno is set to EDOM.
The logfunction takes 1
parameter:
•
double `x`: The input value for which the natural logarithm is to be computed.
Computes the natural logarithm (base e) of the given input `x`. The function is defined for positive values of `x` and returns `-HUGE_VAL` for values less than or equal to 0. Returns the natural logarithm as a `double`.
The log function return value :
Returns the natural logarithm of x
If x is positive infinity, positive infinity is returned
If x is 0, negative infinity is returned and errno is set to ERANGE
For negative x (including negative infinity), a domain error occurs, and errno is set to EDOM
Output
This example demonstrates basic usage of log function to compute the natural logarithm of e.