Computes the Base 10 logarithm.
#include <math.h>
float log10f (x)
float x;
long double log10l (x)
long double x;
double log10 (x)
double x;
_Decimal32 log10d32 (x)
_Decimal32 x;
_Decimal64 log10d64 (x)
_Decimal64 x;
_Decimal128 log10d128 (x)
_Decimal128 x;
The log10f, log10l, log10, log10d32, log10d64, and log10d128 subroutines compute the base 10 logarithm of the x parameter, log10 (x).
An application wishing to check for error situations should set errno to zero and call feclearexcept(FE_ALL_EXCEPT) before calling these subroutines. Upon return, if errno is nonzero or fetestexcept(FE_INVALID | FE_DIVBYZERO | FE_OVERFLOW | FE_UNDERFLOW) is nonzero, an error has occurred.
Item | Description |
---|---|
x | Specifies the value to be computed. |
Upon successful completion, the log10, log10f, log10l, log10d32, log10d64, and log10d128 subroutines return the base 10 logarithm of x.
If x is ±0, a pole error occurs and log10, log10f, log10l, log10d32, log10d64, and log10d128 subroutines return -HUGE_VAL, -HUGE_VALF, -HUGE_VALL, HUGE_VAL_D32, HUGE_VAL_D64, and HUGE_VAL_D128 respectively.
For finite values of x that are less than 0, or if x is -Inf, a domain error occurs, and a NaN is returned.
If x is NaN, a NaN is returned.
If x is 1, +0 is returned.
If x is +Inf, +Inf is returned.
When using the libm.a library:
Item | Description |
---|---|
log10 | If the x parameter is less than 0, the log10 subroutine returns a NaNQ value and sets errno to EDOM. If x= 0, the log10 subroutine returns a -HUGE_VAL value and sets errno to ERANGE. |
When using libmsaa.a(-lmsaa):
Item | Description |
---|---|
log10 | If the x parameter is not positive, the log10 subroutine returns a -HUGE_VAL value and sets errno to EDOM. A message indicating DOMAIN error (or SING error when x = 0) is output to standard error. |
log10 | If x < 0, log10l returns the value NaNQ and sets errno to EDOM. If x equals 0, log10l returns the value -HUGE_VAL but does not modify errno. |