Trait 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§

Source

fn xx_div_mod_y_to_qr(x_1: Self, x_0: Self, y: Self) -> (Self, Self)

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl XXDivModYToQR for u8

Source§

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

Source§

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

Source§

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

Source§

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

Source§

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

Source§

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.

Implementors§