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