Trait malachite_base::num::arithmetic::traits::DivExact
source · pub trait DivExact<RHS = Self> {
type Output;
// Required method
fn div_exact(self, other: RHS) -> Self::Output;
}
Expand description
Divides two numbers, assuming the first exactly divides the second.
If it doesn’t, the div_exact
function may panic or return a meaningless result.
Required Associated Types§
Required Methods§
Implementations on Foreign Types§
source§impl DivExact for i8
impl DivExact for i8
source§fn div_exact(self, other: i8) -> i8
fn div_exact(self, other: i8) -> i8
Divides a value by another value. The first value must be exactly divisible by the second.
If self
is not exactly divisible by other
, this function may panic or return a
meaningless result.
$$ f(x, y) = \frac{x}{y}. $$
If you are unsure whether the division will be exact, use self / other
instead. If
you’re unsure and you want to know, use self.div_mod(other)
and check whether the
remainder is zero. If you want a function that panics if the division is not exact,
use self.div_round(other, Exact)
.
§Worst-case complexity
Constant time and additional memory.
§Panics
Panics if other
is zero or if self
is Self::MIN
and other is -1.
§Examples
See here.
type Output = i8
source§impl DivExact for i16
impl DivExact for i16
source§fn div_exact(self, other: i16) -> i16
fn div_exact(self, other: i16) -> i16
Divides a value by another value. The first value must be exactly divisible by the second.
If self
is not exactly divisible by other
, this function may panic or return a
meaningless result.
$$ f(x, y) = \frac{x}{y}. $$
If you are unsure whether the division will be exact, use self / other
instead. If
you’re unsure and you want to know, use self.div_mod(other)
and check whether the
remainder is zero. If you want a function that panics if the division is not exact,
use self.div_round(other, Exact)
.
§Worst-case complexity
Constant time and additional memory.
§Panics
Panics if other
is zero or if self
is Self::MIN
and other is -1.
§Examples
See here.
type Output = i16
source§impl DivExact for i32
impl DivExact for i32
source§fn div_exact(self, other: i32) -> i32
fn div_exact(self, other: i32) -> i32
Divides a value by another value. The first value must be exactly divisible by the second.
If self
is not exactly divisible by other
, this function may panic or return a
meaningless result.
$$ f(x, y) = \frac{x}{y}. $$
If you are unsure whether the division will be exact, use self / other
instead. If
you’re unsure and you want to know, use self.div_mod(other)
and check whether the
remainder is zero. If you want a function that panics if the division is not exact,
use self.div_round(other, Exact)
.
§Worst-case complexity
Constant time and additional memory.
§Panics
Panics if other
is zero or if self
is Self::MIN
and other is -1.
§Examples
See here.
type Output = i32
source§impl DivExact for i64
impl DivExact for i64
source§fn div_exact(self, other: i64) -> i64
fn div_exact(self, other: i64) -> i64
Divides a value by another value. The first value must be exactly divisible by the second.
If self
is not exactly divisible by other
, this function may panic or return a
meaningless result.
$$ f(x, y) = \frac{x}{y}. $$
If you are unsure whether the division will be exact, use self / other
instead. If
you’re unsure and you want to know, use self.div_mod(other)
and check whether the
remainder is zero. If you want a function that panics if the division is not exact,
use self.div_round(other, Exact)
.
§Worst-case complexity
Constant time and additional memory.
§Panics
Panics if other
is zero or if self
is Self::MIN
and other is -1.
§Examples
See here.
type Output = i64
source§impl DivExact for i128
impl DivExact for i128
source§fn div_exact(self, other: i128) -> i128
fn div_exact(self, other: i128) -> i128
Divides a value by another value. The first value must be exactly divisible by the second.
If self
is not exactly divisible by other
, this function may panic or return a
meaningless result.
$$ f(x, y) = \frac{x}{y}. $$
If you are unsure whether the division will be exact, use self / other
instead. If
you’re unsure and you want to know, use self.div_mod(other)
and check whether the
remainder is zero. If you want a function that panics if the division is not exact,
use self.div_round(other, Exact)
.
§Worst-case complexity
Constant time and additional memory.
§Panics
Panics if other
is zero or if self
is Self::MIN
and other is -1.
§Examples
See here.
type Output = i128
source§impl DivExact for isize
impl DivExact for isize
source§fn div_exact(self, other: isize) -> isize
fn div_exact(self, other: isize) -> isize
Divides a value by another value. The first value must be exactly divisible by the second.
If self
is not exactly divisible by other
, this function may panic or return a
meaningless result.
$$ f(x, y) = \frac{x}{y}. $$
If you are unsure whether the division will be exact, use self / other
instead. If
you’re unsure and you want to know, use self.div_mod(other)
and check whether the
remainder is zero. If you want a function that panics if the division is not exact,
use self.div_round(other, Exact)
.
§Worst-case complexity
Constant time and additional memory.
§Panics
Panics if other
is zero or if self
is Self::MIN
and other is -1.
§Examples
See here.
type Output = isize
source§impl DivExact for u8
impl DivExact for u8
source§fn div_exact(self, other: u8) -> u8
fn div_exact(self, other: u8) -> u8
Divides a value by another value. The first value must be exactly divisible by the second.
If self
is not exactly divisible by other
, this function may panic or return a
meaningless result.
$$ f(x, y) = \frac{x}{y}. $$
If you are unsure whether the division will be exact, use self / other
instead. If
you’re unsure and you want to know, use self.div_mod(other)
and check whether the
remainder is zero. If you want a function that panics if the division is not exact,
use self.div_round(other, Exact)
.
§Worst-case complexity
Constant time and additional memory.
§Panics
Panics if other
is zero or if self
is Self::MIN
and other is -1.
§Examples
See here.
type Output = u8
source§impl DivExact for u16
impl DivExact for u16
source§fn div_exact(self, other: u16) -> u16
fn div_exact(self, other: u16) -> u16
Divides a value by another value. The first value must be exactly divisible by the second.
If self
is not exactly divisible by other
, this function may panic or return a
meaningless result.
$$ f(x, y) = \frac{x}{y}. $$
If you are unsure whether the division will be exact, use self / other
instead. If
you’re unsure and you want to know, use self.div_mod(other)
and check whether the
remainder is zero. If you want a function that panics if the division is not exact,
use self.div_round(other, Exact)
.
§Worst-case complexity
Constant time and additional memory.
§Panics
Panics if other
is zero or if self
is Self::MIN
and other is -1.
§Examples
See here.
type Output = u16
source§impl DivExact for u32
impl DivExact for u32
source§fn div_exact(self, other: u32) -> u32
fn div_exact(self, other: u32) -> u32
Divides a value by another value. The first value must be exactly divisible by the second.
If self
is not exactly divisible by other
, this function may panic or return a
meaningless result.
$$ f(x, y) = \frac{x}{y}. $$
If you are unsure whether the division will be exact, use self / other
instead. If
you’re unsure and you want to know, use self.div_mod(other)
and check whether the
remainder is zero. If you want a function that panics if the division is not exact,
use self.div_round(other, Exact)
.
§Worst-case complexity
Constant time and additional memory.
§Panics
Panics if other
is zero or if self
is Self::MIN
and other is -1.
§Examples
See here.
type Output = u32
source§impl DivExact for u64
impl DivExact for u64
source§fn div_exact(self, other: u64) -> u64
fn div_exact(self, other: u64) -> u64
Divides a value by another value. The first value must be exactly divisible by the second.
If self
is not exactly divisible by other
, this function may panic or return a
meaningless result.
$$ f(x, y) = \frac{x}{y}. $$
If you are unsure whether the division will be exact, use self / other
instead. If
you’re unsure and you want to know, use self.div_mod(other)
and check whether the
remainder is zero. If you want a function that panics if the division is not exact,
use self.div_round(other, Exact)
.
§Worst-case complexity
Constant time and additional memory.
§Panics
Panics if other
is zero or if self
is Self::MIN
and other is -1.
§Examples
See here.
type Output = u64
source§impl DivExact for u128
impl DivExact for u128
source§fn div_exact(self, other: u128) -> u128
fn div_exact(self, other: u128) -> u128
Divides a value by another value. The first value must be exactly divisible by the second.
If self
is not exactly divisible by other
, this function may panic or return a
meaningless result.
$$ f(x, y) = \frac{x}{y}. $$
If you are unsure whether the division will be exact, use self / other
instead. If
you’re unsure and you want to know, use self.div_mod(other)
and check whether the
remainder is zero. If you want a function that panics if the division is not exact,
use self.div_round(other, Exact)
.
§Worst-case complexity
Constant time and additional memory.
§Panics
Panics if other
is zero or if self
is Self::MIN
and other is -1.
§Examples
See here.
type Output = u128
source§impl DivExact for usize
impl DivExact for usize
source§fn div_exact(self, other: usize) -> usize
fn div_exact(self, other: usize) -> usize
Divides a value by another value. The first value must be exactly divisible by the second.
If self
is not exactly divisible by other
, this function may panic or return a
meaningless result.
$$ f(x, y) = \frac{x}{y}. $$
If you are unsure whether the division will be exact, use self / other
instead. If
you’re unsure and you want to know, use self.div_mod(other)
and check whether the
remainder is zero. If you want a function that panics if the division is not exact,
use self.div_round(other, Exact)
.
§Worst-case complexity
Constant time and additional memory.
§Panics
Panics if other
is zero or if self
is Self::MIN
and other is -1.
§Examples
See here.