Trait malachite_base::num::arithmetic::traits::CeilingLogBasePowerOf2
source · [−]pub trait CeilingLogBasePowerOf2<POW> {
type Output;
fn ceiling_log_base_power_of_2(self, pow: POW) -> Self::Output;
}
Expand description
Calculates the ceiling of the base-$2^k$ logarithm of a number.
Required Associated Types
Required Methods
fn ceiling_log_base_power_of_2(self, pow: POW) -> Self::Output
Implementations on Foreign Types
sourceimpl CeilingLogBasePowerOf2<u64> for u8
impl CeilingLogBasePowerOf2<u64> for u8
sourcefn ceiling_log_base_power_of_2(self, pow: u64) -> u64
fn ceiling_log_base_power_of_2(self, pow: u64) -> u64
Returns the ceiling of the base-$2^k$ logarithm of a positive integer.
$f(x, k) = \lceil\log_{2^k} x\rceil$.
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
sourceimpl CeilingLogBasePowerOf2<u64> for u16
impl CeilingLogBasePowerOf2<u64> for u16
sourcefn ceiling_log_base_power_of_2(self, pow: u64) -> u64
fn ceiling_log_base_power_of_2(self, pow: u64) -> u64
Returns the ceiling of the base-$2^k$ logarithm of a positive integer.
$f(x, k) = \lceil\log_{2^k} x\rceil$.
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
sourceimpl CeilingLogBasePowerOf2<u64> for u32
impl CeilingLogBasePowerOf2<u64> for u32
sourcefn ceiling_log_base_power_of_2(self, pow: u64) -> u64
fn ceiling_log_base_power_of_2(self, pow: u64) -> u64
Returns the ceiling of the base-$2^k$ logarithm of a positive integer.
$f(x, k) = \lceil\log_{2^k} x\rceil$.
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
sourceimpl CeilingLogBasePowerOf2<u64> for u64
impl CeilingLogBasePowerOf2<u64> for u64
sourcefn ceiling_log_base_power_of_2(self, pow: u64) -> u64
fn ceiling_log_base_power_of_2(self, pow: u64) -> u64
Returns the ceiling of the base-$2^k$ logarithm of a positive integer.
$f(x, k) = \lceil\log_{2^k} x\rceil$.
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
sourceimpl CeilingLogBasePowerOf2<u64> for u128
impl CeilingLogBasePowerOf2<u64> for u128
sourcefn ceiling_log_base_power_of_2(self, pow: u64) -> u64
fn ceiling_log_base_power_of_2(self, pow: u64) -> u64
Returns the ceiling of the base-$2^k$ logarithm of a positive integer.
$f(x, k) = \lceil\log_{2^k} x\rceil$.
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
sourceimpl CeilingLogBasePowerOf2<u64> for usize
impl CeilingLogBasePowerOf2<u64> for usize
sourcefn ceiling_log_base_power_of_2(self, pow: u64) -> u64
fn ceiling_log_base_power_of_2(self, pow: u64) -> u64
Returns the ceiling of the base-$2^k$ logarithm of a positive integer.
$f(x, k) = \lceil\log_{2^k} x\rceil$.
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
sourceimpl CeilingLogBasePowerOf2<u64> for f32
impl CeilingLogBasePowerOf2<u64> for f32
sourcefn ceiling_log_base_power_of_2(self, pow: u64) -> i64
fn ceiling_log_base_power_of_2(self, pow: u64) -> i64
Returns the ceiling of the base-$2^k$ logarithm of a positive float.
$f(x, k) = \lceil\log_{2^k} x\rceil$.
Worst-case complexity
Constant time and additional memory.
Panics
Panics if self
or pow
are 0.
Examples
See here.
type Output = i64
sourceimpl CeilingLogBasePowerOf2<u64> for f64
impl CeilingLogBasePowerOf2<u64> for f64
sourcefn ceiling_log_base_power_of_2(self, pow: u64) -> i64
fn ceiling_log_base_power_of_2(self, pow: u64) -> i64
Returns the ceiling of the base-$2^k$ logarithm of a positive float.
$f(x, k) = \lceil\log_{2^k} x\rceil$.
Worst-case complexity
Constant time and additional memory.
Panics
Panics if self
or pow
are 0.
Examples
See here.