Trait malachite_base::num::arithmetic::traits::IsPowerOf2

source ·
pub trait IsPowerOf2 {
    // Required method
    fn is_power_of_2(&self) -> bool;
}
Expand description

Determines whether a number is an integer power of 2.

Required Methods§

Implementations on Foreign Types§

source§

impl IsPowerOf2 for f32

source§

fn is_power_of_2(&self) -> bool

Determines whether a number is an integer power of 2.

$f(x) = (\exists n \in \Z : 2^n = x)$.

§Worst-case complexity

Constant time and additional memory.

§Examples

See here.

source§

impl IsPowerOf2 for f64

source§

fn is_power_of_2(&self) -> bool

Determines whether a number is an integer power of 2.

$f(x) = (\exists n \in \Z : 2^n = x)$.

§Worst-case complexity

Constant time and additional memory.

§Examples

See here.

source§

impl IsPowerOf2 for u8

source§

fn is_power_of_2(&self) -> bool

This is a wrapper over the is_power_of_two functions in the standard library, for example this one.

source§

impl IsPowerOf2 for u16

source§

fn is_power_of_2(&self) -> bool

This is a wrapper over the is_power_of_two functions in the standard library, for example this one.

source§

impl IsPowerOf2 for u32

source§

fn is_power_of_2(&self) -> bool

This is a wrapper over the is_power_of_two functions in the standard library, for example this one.

source§

impl IsPowerOf2 for u64

source§

fn is_power_of_2(&self) -> bool

This is a wrapper over the is_power_of_two functions in the standard library, for example this one.

source§

impl IsPowerOf2 for u128

source§

fn is_power_of_2(&self) -> bool

This is a wrapper over the is_power_of_two functions in the standard library, for example this one.

source§

impl IsPowerOf2 for usize

source§

fn is_power_of_2(&self) -> bool

This is a wrapper over the is_power_of_two functions in the standard library, for example this one.

Implementors§