Trait malachite_base::num::arithmetic::traits::CeilingLogBase2
source · pub trait CeilingLogBase2 {
type Output;
fn ceiling_log_base_2(self) -> Self::Output;
}Expand description
Calculates the ceiling of the base-2 logarithm of a number.
Required Associated Types§
Required Methods§
fn ceiling_log_base_2(self) -> Self::Output
Implementations on Foreign Types§
source§impl CeilingLogBase2 for u8
impl CeilingLogBase2 for u8
source§impl CeilingLogBase2 for u16
impl CeilingLogBase2 for u16
source§impl CeilingLogBase2 for u32
impl CeilingLogBase2 for u32
source§impl CeilingLogBase2 for u64
impl CeilingLogBase2 for u64
source§impl CeilingLogBase2 for u128
impl CeilingLogBase2 for u128
source§impl CeilingLogBase2 for usize
impl CeilingLogBase2 for usize
source§impl CeilingLogBase2 for f32
impl CeilingLogBase2 for f32
source§fn ceiling_log_base_2(self) -> i64
fn ceiling_log_base_2(self) -> i64
Returns the ceiling of the base-2 logarithm of a positive float.
$f(x) = \lceil\log_2 x\rceil$.
Worst-case complexity
Constant time and additional memory.
Panics
Panics if self is infinite, NaN, or less than or equal to zero.
Examples
See here.
type Output = i64
source§impl CeilingLogBase2 for f64
impl CeilingLogBase2 for f64
source§fn ceiling_log_base_2(self) -> i64
fn ceiling_log_base_2(self) -> i64
Returns the ceiling of the base-2 logarithm of a positive float.
$f(x) = \lceil\log_2 x\rceil$.
Worst-case complexity
Constant time and additional memory.
Panics
Panics if self is infinite, NaN, or less than or equal to zero.
Examples
See here.