Trait malachite_base::num::arithmetic::traits::FloorLogBase
source · pub trait FloorLogBase<B = Self> {
type Output;
// Required method
fn floor_log_base(self, base: B) -> Self::Output;
}
Expand description
Calculates the floor of the base-$b$ logarithm of a number.
Required Associated Types§
Required Methods§
fn floor_log_base(self, base: B) -> Self::Output
Implementations on Foreign Types§
source§impl FloorLogBase for u8
impl FloorLogBase for u8
source§fn floor_log_base(self, base: u8) -> u64
fn floor_log_base(self, base: u8) -> u64
Returns the floor of the base-$b$ logarithm of a positive integer.
$f(x, b) = \lfloor\log_b x\rfloor$.
§Worst-case complexity
$T(n) = O(n)$
$M(n) = O(1)$
where $T$ is time, $M$ is additional memory, and $n$ is self.significant_bits() / base.significant_bits()
.
§Panics
Panics if self
is 0 or base
is less than 2.
§Examples
See here.
type Output = u64
source§impl FloorLogBase for u16
impl FloorLogBase for u16
source§fn floor_log_base(self, base: u16) -> u64
fn floor_log_base(self, base: u16) -> u64
Returns the floor of the base-$b$ logarithm of a positive integer.
$f(x, b) = \lfloor\log_b x\rfloor$.
§Worst-case complexity
$T(n) = O(n)$
$M(n) = O(1)$
where $T$ is time, $M$ is additional memory, and $n$ is self.significant_bits() / base.significant_bits()
.
§Panics
Panics if self
is 0 or base
is less than 2.
§Examples
See here.
type Output = u64
source§impl FloorLogBase for u32
impl FloorLogBase for u32
source§fn floor_log_base(self, base: u32) -> u64
fn floor_log_base(self, base: u32) -> u64
Returns the floor of the base-$b$ logarithm of a positive integer.
$f(x, b) = \lfloor\log_b x\rfloor$.
§Worst-case complexity
$T(n) = O(n)$
$M(n) = O(1)$
where $T$ is time, $M$ is additional memory, and $n$ is self.significant_bits() / base.significant_bits()
.
§Panics
Panics if self
is 0 or base
is less than 2.
§Examples
See here.
type Output = u64
source§impl FloorLogBase for u64
impl FloorLogBase for u64
source§fn floor_log_base(self, base: u64) -> u64
fn floor_log_base(self, base: u64) -> u64
Returns the floor of the base-$b$ logarithm of a positive integer.
$f(x, b) = \lfloor\log_b x\rfloor$.
§Worst-case complexity
$T(n) = O(n)$
$M(n) = O(1)$
where $T$ is time, $M$ is additional memory, and $n$ is self.significant_bits() / base.significant_bits()
.
§Panics
Panics if self
is 0 or base
is less than 2.
§Examples
See here.
type Output = u64
source§impl FloorLogBase for u128
impl FloorLogBase for u128
source§fn floor_log_base(self, base: u128) -> u64
fn floor_log_base(self, base: u128) -> u64
Returns the floor of the base-$b$ logarithm of a positive integer.
$f(x, b) = \lfloor\log_b x\rfloor$.
§Worst-case complexity
$T(n) = O(n)$
$M(n) = O(1)$
where $T$ is time, $M$ is additional memory, and $n$ is self.significant_bits() / base.significant_bits()
.
§Panics
Panics if self
is 0 or base
is less than 2.
§Examples
See here.
type Output = u64
source§impl FloorLogBase for usize
impl FloorLogBase for usize
source§fn floor_log_base(self, base: usize) -> u64
fn floor_log_base(self, base: usize) -> u64
Returns the floor of the base-$b$ logarithm of a positive integer.
$f(x, b) = \lfloor\log_b x\rfloor$.
§Worst-case complexity
$T(n) = O(n)$
$M(n) = O(1)$
where $T$ is time, $M$ is additional memory, and $n$ is self.significant_bits() / base.significant_bits()
.
§Panics
Panics if self
is 0 or base
is less than 2.
§Examples
See here.