Trait malachite_base::num::arithmetic::traits::DivisibleBy

source ·
pub trait DivisibleBy<RHS = Self> {
    // Required method
    fn divisible_by(self, other: RHS) -> bool;
}
Expand description

Determines whether a number is divisible by another number.

Required Methods§

source

fn divisible_by(self, other: RHS) -> bool

Implementations on Foreign Types§

source§

impl DivisibleBy for i8

source§

fn divisible_by(self, other: i8) -> bool

Returns whether a number is divisible by another number; in other words, whether the first number is a multiple of the second.

This means that zero is divisible by any number, including zero; but a nonzero number is never divisible by zero.

$f(x, m) = (m|x)$.

$f(x, m) = (\exists k \in \Z : \ x = km)$.

§Worst-case complexity

Constant time and additional memory.

§Examples

See here.

source§

impl DivisibleBy for i16

source§

fn divisible_by(self, other: i16) -> bool

Returns whether a number is divisible by another number; in other words, whether the first number is a multiple of the second.

This means that zero is divisible by any number, including zero; but a nonzero number is never divisible by zero.

$f(x, m) = (m|x)$.

$f(x, m) = (\exists k \in \Z : \ x = km)$.

§Worst-case complexity

Constant time and additional memory.

§Examples

See here.

source§

impl DivisibleBy for i32

source§

fn divisible_by(self, other: i32) -> bool

Returns whether a number is divisible by another number; in other words, whether the first number is a multiple of the second.

This means that zero is divisible by any number, including zero; but a nonzero number is never divisible by zero.

$f(x, m) = (m|x)$.

$f(x, m) = (\exists k \in \Z : \ x = km)$.

§Worst-case complexity

Constant time and additional memory.

§Examples

See here.

source§

impl DivisibleBy for i64

source§

fn divisible_by(self, other: i64) -> bool

Returns whether a number is divisible by another number; in other words, whether the first number is a multiple of the second.

This means that zero is divisible by any number, including zero; but a nonzero number is never divisible by zero.

$f(x, m) = (m|x)$.

$f(x, m) = (\exists k \in \Z : \ x = km)$.

§Worst-case complexity

Constant time and additional memory.

§Examples

See here.

source§

impl DivisibleBy for i128

source§

fn divisible_by(self, other: i128) -> bool

Returns whether a number is divisible by another number; in other words, whether the first number is a multiple of the second.

This means that zero is divisible by any number, including zero; but a nonzero number is never divisible by zero.

$f(x, m) = (m|x)$.

$f(x, m) = (\exists k \in \Z : \ x = km)$.

§Worst-case complexity

Constant time and additional memory.

§Examples

See here.

source§

impl DivisibleBy for isize

source§

fn divisible_by(self, other: isize) -> bool

Returns whether a number is divisible by another number; in other words, whether the first number is a multiple of the second.

This means that zero is divisible by any number, including zero; but a nonzero number is never divisible by zero.

$f(x, m) = (m|x)$.

$f(x, m) = (\exists k \in \Z : \ x = km)$.

§Worst-case complexity

Constant time and additional memory.

§Examples

See here.

source§

impl DivisibleBy for u8

source§

fn divisible_by(self, other: u8) -> bool

Returns whether a number is divisible by another number; in other words, whether the first number is a multiple of the second.

This means that zero is divisible by any number, including zero; but a nonzero number is never divisible by zero.

$f(x, m) = (m|x)$.

$f(x, m) = (\exists k \in \N : x = km)$.

§Worst-case complexity

Constant time and additional memory.

§Examples

See here.

source§

impl DivisibleBy for u16

source§

fn divisible_by(self, other: u16) -> bool

Returns whether a number is divisible by another number; in other words, whether the first number is a multiple of the second.

This means that zero is divisible by any number, including zero; but a nonzero number is never divisible by zero.

$f(x, m) = (m|x)$.

$f(x, m) = (\exists k \in \N : x = km)$.

§Worst-case complexity

Constant time and additional memory.

§Examples

See here.

source§

impl DivisibleBy for u32

source§

fn divisible_by(self, other: u32) -> bool

Returns whether a number is divisible by another number; in other words, whether the first number is a multiple of the second.

This means that zero is divisible by any number, including zero; but a nonzero number is never divisible by zero.

$f(x, m) = (m|x)$.

$f(x, m) = (\exists k \in \N : x = km)$.

§Worst-case complexity

Constant time and additional memory.

§Examples

See here.

source§

impl DivisibleBy for u64

source§

fn divisible_by(self, other: u64) -> bool

Returns whether a number is divisible by another number; in other words, whether the first number is a multiple of the second.

This means that zero is divisible by any number, including zero; but a nonzero number is never divisible by zero.

$f(x, m) = (m|x)$.

$f(x, m) = (\exists k \in \N : x = km)$.

§Worst-case complexity

Constant time and additional memory.

§Examples

See here.

source§

impl DivisibleBy for u128

source§

fn divisible_by(self, other: u128) -> bool

Returns whether a number is divisible by another number; in other words, whether the first number is a multiple of the second.

This means that zero is divisible by any number, including zero; but a nonzero number is never divisible by zero.

$f(x, m) = (m|x)$.

$f(x, m) = (\exists k \in \N : x = km)$.

§Worst-case complexity

Constant time and additional memory.

§Examples

See here.

source§

impl DivisibleBy for usize

source§

fn divisible_by(self, other: usize) -> bool

Returns whether a number is divisible by another number; in other words, whether the first number is a multiple of the second.

This means that zero is divisible by any number, including zero; but a nonzero number is never divisible by zero.

$f(x, m) = (m|x)$.

$f(x, m) = (\exists k \in \N : x = km)$.

§Worst-case complexity

Constant time and additional memory.

§Examples

See here.

Implementors§