math.log2(x)
copy
Where x
is the number whose base-2 logarithm we want.
The math.log2 function is shorthand for math.log() function with 2 as the base i.e math.log(x, 2)
A ValueError
is raised if the value given as argument is negative.
module usage
module usage
random.random()
random.randint()
random.choice()
Choosing random item(s)
random.choices()
random.sample()
random.shuffle()
Introduction
cmath module
math.sin()
math.cos()
math.tan()
math.asin()
math.acos()
math.atan()
math.atan2()
math.sinh()
math.cosh()
math.tanh()
math.asinh()
math.acosh()
math.atanh()
math.exp()
math.pow()
math.sqrt()
math.log()
math.log2()
math.log10()
math.ceil()
math.floor()
math.trunc()
math.modf()
math.fmod()
math.fabs()
math.factorial()
math.gcd()
math.lcm()
math.isqrt()
math.isfinite()
math.isinf()
math.isnan()
math.ldexp()
math.frexp()
math.degrees()
math.radians()
math.copysign()
math.fsum()
math.gamma()
math.hypot()
math.isclose()
math.lgamma()
math.prod()
math.perm()
math.erf()
math.erfc()
math.dist()
math.comb()
math.remainder()
math.pi
math.e
math.inf
math.nan
math.tau
cmath.acosh()
cmath.acos()
cmath.asin()
cmath.asinh()
cmath.atan()
cmath.atanh()
cmath.cos()
cmath.cosh()
cmath.exp()
cmath.isclose()
cmath.isfinite()
cmath.isinf()
cmath.isnan()
cmath.log()
cmath.log10()
cmath.phase()
cmath.polar()
cmath.rect()
cmath.sin()
cmath.sinh()
cmath.sqrt()
cmath.tan()
cmath.tanh()
cmath.e
cmath.inf
cmath.infj
cmath.nan
cmath.nanj
cmath.pi
cmath.tau
math.log2(x)
copy
Where x
is the number whose base-2 logarithm we want.
The math.log2 function is shorthand for math.log() function with 2 as the base i.e math.log(x, 2)
A ValueError
is raised if the value given as argument is negative.