Trait malachite_base::num::arithmetic::traits::FloorLogBase
source · [−]pub trait FloorLogBase<B = Self> {
type Output;
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
sourceimpl FloorLogBase<u8> for u8
impl FloorLogBase<u8> for u8
sourcefn 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
sourceimpl FloorLogBase<u16> for u16
impl FloorLogBase<u16> for u16
sourcefn 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
sourceimpl FloorLogBase<u32> for u32
impl FloorLogBase<u32> for u32
sourcefn 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
sourceimpl FloorLogBase<u64> for u64
impl FloorLogBase<u64> for u64
sourcefn 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
sourceimpl FloorLogBase<u128> for u128
impl FloorLogBase<u128> for u128
sourcefn 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
sourceimpl FloorLogBase<usize> for usize
impl FloorLogBase<usize> for usize
sourcefn 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.