Trait malachite_base::num::arithmetic::traits::CeilingLogBase
source · [−]pub trait CeilingLogBase<B = Self> {
type Output;
fn ceiling_log_base(self, base: B) -> Self::Output;
}
Expand description
Calculates the ceiling of the base-$b$ logarithm of a number.
Required Associated Types
Required Methods
fn ceiling_log_base(self, base: B) -> Self::Output
Implementations on Foreign Types
sourceimpl CeilingLogBase<u8> for u8
impl CeilingLogBase<u8> for u8
sourcefn ceiling_log_base(self, base: u8) -> u64
fn ceiling_log_base(self, base: u8) -> u64
Returns the ceiling of the base-$b$ logarithm of a positive integer.
$f(x, b) = \lceil\log_b x\rceil$.
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 CeilingLogBase<u16> for u16
impl CeilingLogBase<u16> for u16
sourcefn ceiling_log_base(self, base: u16) -> u64
fn ceiling_log_base(self, base: u16) -> u64
Returns the ceiling of the base-$b$ logarithm of a positive integer.
$f(x, b) = \lceil\log_b x\rceil$.
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 CeilingLogBase<u32> for u32
impl CeilingLogBase<u32> for u32
sourcefn ceiling_log_base(self, base: u32) -> u64
fn ceiling_log_base(self, base: u32) -> u64
Returns the ceiling of the base-$b$ logarithm of a positive integer.
$f(x, b) = \lceil\log_b x\rceil$.
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 CeilingLogBase<u64> for u64
impl CeilingLogBase<u64> for u64
sourcefn ceiling_log_base(self, base: u64) -> u64
fn ceiling_log_base(self, base: u64) -> u64
Returns the ceiling of the base-$b$ logarithm of a positive integer.
$f(x, b) = \lceil\log_b x\rceil$.
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 CeilingLogBase<u128> for u128
impl CeilingLogBase<u128> for u128
sourcefn ceiling_log_base(self, base: u128) -> u64
fn ceiling_log_base(self, base: u128) -> u64
Returns the ceiling of the base-$b$ logarithm of a positive integer.
$f(x, b) = \lceil\log_b x\rceil$.
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 CeilingLogBase<usize> for usize
impl CeilingLogBase<usize> for usize
sourcefn ceiling_log_base(self, base: usize) -> u64
fn ceiling_log_base(self, base: usize) -> u64
Returns the ceiling of the base-$b$ logarithm of a positive integer.
$f(x, b) = \lceil\log_b x\rceil$.
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.