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

Syntax

#include <math.h>

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

Description

These functions compute the logarithm of the positive floating-point number x to the base 2.

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.
errno is set to indicate the error.

Errors

log2(), log2f() and log2l() will fail if:

 

EDOM

The value of x is negative.

 

ERANGE

The value of x is 0.

See also

exp()exp2(), log()log10(), pow(), sqrt(), math.h.