Trait malachite_base::num::arithmetic::traits::CeilingLogBase
source · pub trait CeilingLogBase<B = Self> {
type Output;
// Required method
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§
source§impl CeilingLogBase for u8
impl CeilingLogBase for u8
source§fn 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
source§impl CeilingLogBase for u16
impl CeilingLogBase for u16
source§fn 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
source§impl CeilingLogBase for u32
impl CeilingLogBase for u32
source§fn 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
source§impl CeilingLogBase for u64
impl CeilingLogBase for u64
source§fn 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
source§impl CeilingLogBase for u128
impl CeilingLogBase for u128
source§fn 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
source§impl CeilingLogBase for usize
impl CeilingLogBase for usize
source§fn 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.