Your Browser is not longer supported

Please use Google Chrome, Mozilla Firefox or Microsoft Edge to view the page correctly
Loading...

{{viewport.spaceProperty.prod}}

log2, log2f, log2l - base 2 logarithm function

&pagelevel(4)&pagelevel

Definition

#include <math.h>

double log2(double x);
float log2f(double x); (C11)
long double log2l(long double x); (C11)

These functions calculate the natural logarithm of the positive floating-point number x to the base 10.

Return val.

log2(x)

for a positive x.


-HUGE_VAL
-HUGE_VALF
-HUGE_VALL

depending on the function type,
if x is less than or equal to 0. In addition, errno is set to EDOM (domain error)

or
if x is equal to 0. In addition, errno is set to ERANGE.

See also

log, log10, exp, exp2