Trait malachite_base::num::arithmetic::traits::FloorLogBasePowerOf2
source · pub trait FloorLogBasePowerOf2<POW> {
type Output;
fn floor_log_base_power_of_2(self, pow: POW) -> Self::Output;
}
Expand description
Calculates the floor of the base-$2^k$ logarithm of a number.
Required Associated Types§
Required Methods§
fn floor_log_base_power_of_2(self, pow: POW) -> Self::Output
Implementations on Foreign Types§
source§impl FloorLogBasePowerOf2<u64> for u8
impl FloorLogBasePowerOf2<u64> for u8
source§fn floor_log_base_power_of_2(self, pow: u64) -> u64
fn floor_log_base_power_of_2(self, pow: u64) -> u64
Returns the floor of the base-$2^k$ logarithm of a positive integer.
$f(x, k) = \lfloor\log_{2^k} x\rfloor$.
Worst-case complexity
Constant time and additional memory.
Panics
Panics if self
is infinite, NaN
, or less than or equal to zero, or if pow
is
zero.
Examples
See here.
type Output = u64
source§impl FloorLogBasePowerOf2<u64> for u16
impl FloorLogBasePowerOf2<u64> for u16
source§fn floor_log_base_power_of_2(self, pow: u64) -> u64
fn floor_log_base_power_of_2(self, pow: u64) -> u64
Returns the floor of the base-$2^k$ logarithm of a positive integer.
$f(x, k) = \lfloor\log_{2^k} x\rfloor$.
Worst-case complexity
Constant time and additional memory.
Panics
Panics if self
is infinite, NaN
, or less than or equal to zero, or if pow
is
zero.
Examples
See here.
type Output = u64
source§impl FloorLogBasePowerOf2<u64> for u32
impl FloorLogBasePowerOf2<u64> for u32
source§fn floor_log_base_power_of_2(self, pow: u64) -> u64
fn floor_log_base_power_of_2(self, pow: u64) -> u64
Returns the floor of the base-$2^k$ logarithm of a positive integer.
$f(x, k) = \lfloor\log_{2^k} x\rfloor$.
Worst-case complexity
Constant time and additional memory.
Panics
Panics if self
is infinite, NaN
, or less than or equal to zero, or if pow
is
zero.
Examples
See here.
type Output = u64
source§impl FloorLogBasePowerOf2<u64> for u64
impl FloorLogBasePowerOf2<u64> for u64
source§fn floor_log_base_power_of_2(self, pow: u64) -> u64
fn floor_log_base_power_of_2(self, pow: u64) -> u64
Returns the floor of the base-$2^k$ logarithm of a positive integer.
$f(x, k) = \lfloor\log_{2^k} x\rfloor$.
Worst-case complexity
Constant time and additional memory.
Panics
Panics if self
is infinite, NaN
, or less than or equal to zero, or if pow
is
zero.
Examples
See here.
type Output = u64
source§impl FloorLogBasePowerOf2<u64> for u128
impl FloorLogBasePowerOf2<u64> for u128
source§fn floor_log_base_power_of_2(self, pow: u64) -> u64
fn floor_log_base_power_of_2(self, pow: u64) -> u64
Returns the floor of the base-$2^k$ logarithm of a positive integer.
$f(x, k) = \lfloor\log_{2^k} x\rfloor$.
Worst-case complexity
Constant time and additional memory.
Panics
Panics if self
is infinite, NaN
, or less than or equal to zero, or if pow
is
zero.
Examples
See here.
type Output = u64
source§impl FloorLogBasePowerOf2<u64> for usize
impl FloorLogBasePowerOf2<u64> for usize
source§fn floor_log_base_power_of_2(self, pow: u64) -> u64
fn floor_log_base_power_of_2(self, pow: u64) -> u64
Returns the floor of the base-$2^k$ logarithm of a positive integer.
$f(x, k) = \lfloor\log_{2^k} x\rfloor$.
Worst-case complexity
Constant time and additional memory.
Panics
Panics if self
is infinite, NaN
, or less than or equal to zero, or if pow
is
zero.
Examples
See here.