Trait malachite_base::num::arithmetic::traits::Parity

source ·
pub trait Parity {
    // Required methods
    fn even(self) -> bool;
    fn odd(self) -> bool;
}
Expand description

Determines whether a number is even or odd.

Required Methods§

source

fn even(self) -> bool

Determines whether a number is even.

source

fn odd(self) -> bool

Determines whether a number is odd.

Implementations on Foreign Types§

source§

impl Parity for i8

source§

fn even(self) -> bool

Tests whether a number is even.

$f(x) = (2|x)$.

$f(x) = (\exists k \in \N \ x = 2k)$.

§Worst-case complexity

Constant time and additional memory.

§Examples

See here.

source§

fn odd(self) -> bool

Tests whether a number is odd.

$f(x) = (2\nmid x)$.

$f(x) = (\exists k \in \N \ x = 2k+1)$.

§Worst-case complexity

Constant time and additional memory.

§Examples

See here.

source§

impl Parity for i16

source§

fn even(self) -> bool

Tests whether a number is even.

$f(x) = (2|x)$.

$f(x) = (\exists k \in \N \ x = 2k)$.

§Worst-case complexity

Constant time and additional memory.

§Examples

See here.

source§

fn odd(self) -> bool

Tests whether a number is odd.

$f(x) = (2\nmid x)$.

$f(x) = (\exists k \in \N \ x = 2k+1)$.

§Worst-case complexity

Constant time and additional memory.

§Examples

See here.

source§

impl Parity for i32

source§

fn even(self) -> bool

Tests whether a number is even.

$f(x) = (2|x)$.

$f(x) = (\exists k \in \N \ x = 2k)$.

§Worst-case complexity

Constant time and additional memory.

§Examples

See here.

source§

fn odd(self) -> bool

Tests whether a number is odd.

$f(x) = (2\nmid x)$.

$f(x) = (\exists k \in \N \ x = 2k+1)$.

§Worst-case complexity

Constant time and additional memory.

§Examples

See here.

source§

impl Parity for i64

source§

fn even(self) -> bool

Tests whether a number is even.

$f(x) = (2|x)$.

$f(x) = (\exists k \in \N \ x = 2k)$.

§Worst-case complexity

Constant time and additional memory.

§Examples

See here.

source§

fn odd(self) -> bool

Tests whether a number is odd.

$f(x) = (2\nmid x)$.

$f(x) = (\exists k \in \N \ x = 2k+1)$.

§Worst-case complexity

Constant time and additional memory.

§Examples

See here.

source§

impl Parity for i128

source§

fn even(self) -> bool

Tests whether a number is even.

$f(x) = (2|x)$.

$f(x) = (\exists k \in \N \ x = 2k)$.

§Worst-case complexity

Constant time and additional memory.

§Examples

See here.

source§

fn odd(self) -> bool

Tests whether a number is odd.

$f(x) = (2\nmid x)$.

$f(x) = (\exists k \in \N \ x = 2k+1)$.

§Worst-case complexity

Constant time and additional memory.

§Examples

See here.

source§

impl Parity for isize

source§

fn even(self) -> bool

Tests whether a number is even.

$f(x) = (2|x)$.

$f(x) = (\exists k \in \N \ x = 2k)$.

§Worst-case complexity

Constant time and additional memory.

§Examples

See here.

source§

fn odd(self) -> bool

Tests whether a number is odd.

$f(x) = (2\nmid x)$.

$f(x) = (\exists k \in \N \ x = 2k+1)$.

§Worst-case complexity

Constant time and additional memory.

§Examples

See here.

source§

impl Parity for u8

source§

fn even(self) -> bool

Tests whether a number is even.

$f(x) = (2|x)$.

$f(x) = (\exists k \in \N \ x = 2k)$.

§Worst-case complexity

Constant time and additional memory.

§Examples

See here.

source§

fn odd(self) -> bool

Tests whether a number is odd.

$f(x) = (2\nmid x)$.

$f(x) = (\exists k \in \N \ x = 2k+1)$.

§Worst-case complexity

Constant time and additional memory.

§Examples

See here.

source§

impl Parity for u16

source§

fn even(self) -> bool

Tests whether a number is even.

$f(x) = (2|x)$.

$f(x) = (\exists k \in \N \ x = 2k)$.

§Worst-case complexity

Constant time and additional memory.

§Examples

See here.

source§

fn odd(self) -> bool

Tests whether a number is odd.

$f(x) = (2\nmid x)$.

$f(x) = (\exists k \in \N \ x = 2k+1)$.

§Worst-case complexity

Constant time and additional memory.

§Examples

See here.

source§

impl Parity for u32

source§

fn even(self) -> bool

Tests whether a number is even.

$f(x) = (2|x)$.

$f(x) = (\exists k \in \N \ x = 2k)$.

§Worst-case complexity

Constant time and additional memory.

§Examples

See here.

source§

fn odd(self) -> bool

Tests whether a number is odd.

$f(x) = (2\nmid x)$.

$f(x) = (\exists k \in \N \ x = 2k+1)$.

§Worst-case complexity

Constant time and additional memory.

§Examples

See here.

source§

impl Parity for u64

source§

fn even(self) -> bool

Tests whether a number is even.

$f(x) = (2|x)$.

$f(x) = (\exists k \in \N \ x = 2k)$.

§Worst-case complexity

Constant time and additional memory.

§Examples

See here.

source§

fn odd(self) -> bool

Tests whether a number is odd.

$f(x) = (2\nmid x)$.

$f(x) = (\exists k \in \N \ x = 2k+1)$.

§Worst-case complexity

Constant time and additional memory.

§Examples

See here.

source§

impl Parity for u128

source§

fn even(self) -> bool

Tests whether a number is even.

$f(x) = (2|x)$.

$f(x) = (\exists k \in \N \ x = 2k)$.

§Worst-case complexity

Constant time and additional memory.

§Examples

See here.

source§

fn odd(self) -> bool

Tests whether a number is odd.

$f(x) = (2\nmid x)$.

$f(x) = (\exists k \in \N \ x = 2k+1)$.

§Worst-case complexity

Constant time and additional memory.

§Examples

See here.

source§

impl Parity for usize

source§

fn even(self) -> bool

Tests whether a number is even.

$f(x) = (2|x)$.

$f(x) = (\exists k \in \N \ x = 2k)$.

§Worst-case complexity

Constant time and additional memory.

§Examples

See here.

source§

fn odd(self) -> bool

Tests whether a number is odd.

$f(x) = (2\nmid x)$.

$f(x) = (\exists k \in \N \ x = 2k+1)$.

§Worst-case complexity

Constant time and additional memory.

§Examples

See here.

Implementors§