Trait malachite_base::num::arithmetic::traits::XXDivModYToQR
source · pub trait XXDivModYToQR: Sized {
// Required method
fn xx_div_mod_y_to_qr(x_1: Self, x_0: Self, y: Self) -> (Self, Self);
}
Expand description
Computes the quotient and remainder of two numbers. The first is composed of two Self
values,
and the second of a single one.
x_1
must be less than y
.
Required Methods§
fn xx_div_mod_y_to_qr(x_1: Self, x_0: Self, y: Self) -> (Self, Self)
Object Safety§
Implementations on Foreign Types§
source§impl XXDivModYToQR for u8
impl XXDivModYToQR for u8
source§fn xx_div_mod_y_to_qr(x_1: u8, x_0: u8, y: u8) -> (u8, u8)
fn xx_div_mod_y_to_qr(x_1: u8, x_0: u8, y: u8) -> (u8, u8)
Computes the quotient and remainder of two numbers. The first is composed of two
Self
values, and the second of a single one.
x_1
must be less than y
.
$$
f(x_1, x_0, y) = (q, r),
$$
where $W$ is Self::WIDTH
,
$x_1, x_0, y, q, r < 2^W$,
$x_1, r < y$, and $$ qy + r = 2^Wx_1 + x_0. $$
§Worst-case complexity
Constant time and additional memory.
§Examples
See here.
This is equivalent to udiv_qrnnd
from longlong.h
, FLINT 2.7.1, where (q, r)
is
returned.
source§impl XXDivModYToQR for u16
impl XXDivModYToQR for u16
source§fn xx_div_mod_y_to_qr(x_1: u16, x_0: u16, y: u16) -> (u16, u16)
fn xx_div_mod_y_to_qr(x_1: u16, x_0: u16, y: u16) -> (u16, u16)
Computes the quotient and remainder of two numbers. The first is composed of two
Self
values, and the second of a single one.
x_1
must be less than y
.
$$
f(x_1, x_0, y) = (q, r),
$$
where $W$ is Self::WIDTH
,
$x_1, x_0, y, q, r < 2^W$,
$x_1, r < y$, and $$ qy + r = 2^Wx_1 + x_0. $$
§Worst-case complexity
Constant time and additional memory.
§Examples
See here.
This is equivalent to udiv_qrnnd
from longlong.h
, FLINT 2.7.1, where (q, r)
is
returned.
source§impl XXDivModYToQR for u32
impl XXDivModYToQR for u32
source§fn xx_div_mod_y_to_qr(x_1: u32, x_0: u32, y: u32) -> (u32, u32)
fn xx_div_mod_y_to_qr(x_1: u32, x_0: u32, y: u32) -> (u32, u32)
Computes the quotient and remainder of two numbers. The first is composed of two
Self
values, and the second of a single one.
x_1
must be less than y
.
$$
f(x_1, x_0, y) = (q, r),
$$
where $W$ is Self::WIDTH
,
$x_1, x_0, y, q, r < 2^W$,
$x_1, r < y$, and $$ qy + r = 2^Wx_1 + x_0. $$
§Worst-case complexity
Constant time and additional memory.
§Examples
See here.
This is equivalent to udiv_qrnnd
from longlong.h
, FLINT 2.7.1, where (q, r)
is
returned.
source§impl XXDivModYToQR for u64
impl XXDivModYToQR for u64
source§fn xx_div_mod_y_to_qr(x_1: u64, x_0: u64, y: u64) -> (u64, u64)
fn xx_div_mod_y_to_qr(x_1: u64, x_0: u64, y: u64) -> (u64, u64)
Computes the quotient and remainder of two numbers. The first is composed of two
Self
values, and the second of a single one.
x_1
must be less than y
.
$$
f(x_1, x_0, y) = (q, r),
$$
where $W$ is Self::WIDTH
,
$x_1, x_0, y, q, r < 2^W$,
$x_1, r < y$, and $$ qy + r = 2^Wx_1 + x_0. $$
§Worst-case complexity
Constant time and additional memory.
§Examples
See here.
This is equivalent to udiv_qrnnd
from longlong.h
, FLINT 2.7.1, where (q, r)
is
returned.
source§impl XXDivModYToQR for u128
impl XXDivModYToQR for u128
source§fn xx_div_mod_y_to_qr(x_1: u128, x_0: u128, y: u128) -> (u128, u128)
fn xx_div_mod_y_to_qr(x_1: u128, x_0: u128, y: u128) -> (u128, u128)
Computes the quotient and remainder of two numbers. The first is composed of two u128
values, and the second of a single one.
x_1
must be less than y
.
$$
f(x_1, x_0, y) = (q, r),
$$
where $W$ is Self::WIDTH
,
$x_1, x_0, y, q, r < 2^W$,
$x_1, r < y$, and $$ qy + r = 2^Wx_1 + x_0. $$
§Worst-case complexity
Constant time and additional memory.
§Examples
See here.
This is equivalent to udiv_qrnnd
from longlong.h
, FLINT 2.7.1, where (q, r)
is
returned.
source§impl XXDivModYToQR for usize
impl XXDivModYToQR for usize
source§fn xx_div_mod_y_to_qr(x_1: usize, x_0: usize, y: usize) -> (usize, usize)
fn xx_div_mod_y_to_qr(x_1: usize, x_0: usize, y: usize) -> (usize, usize)
Computes the quotient and remainder of two numbers. The first is composed of two usize
values, and the second of a single one.
x_1
must be less than y
.
$$
f(x_1, x_0, y) = (q, r),
$$
where $W$ is Self::WIDTH
,
$x_1, x_0, y, q, r < 2^W$,
$x_1, r < y$, and $$ qy + r = 2^Wx_1 + x_0. $$
§Worst-case complexity
Constant time and additional memory.
§Examples
See here.
This is udiv_qrnnd
from longlong.h
, FLINT 2.7.1, where (q, r)
is returned.