Computes base 2 logarithm.
#include <math.h> double log2 (x) double x; float log2f (x) float x; long double log2l (x) long double x;
The log2, log2f, and log2l subroutines compute the base 2 logarithm of the x parameter, log2 (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.
x | Specifies the value to be computed. |
Upon successful completion, the log2, log2f, and log2l subroutines return the base 2 logarithm of x.
If x is ±0, a pole error occurs and the log2, log2f, and log2l subroutines return -HUGE_VAL, -HUGE_VALF, and -HUGE_VALL, 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, x is returned.
feclearexcept Subroutine and fetestexcept Subroutine.
math.h in AIX 5L Version 5.2 Files Reference.