Trait malachite_base::num::arithmetic::traits::RootAssignRem
source · [−]pub trait RootAssignRem<POW> {
type RemOutput;
fn root_assign_rem(&mut self, exp: POW) -> Self::RemOutput;
}
Expand description
Replaces a number with the floor of its $n$th root, returning the remainder.
Required Associated Types
Required Methods
fn root_assign_rem(&mut self, exp: POW) -> Self::RemOutput
Implementations on Foreign Types
sourceimpl RootAssignRem<u64> for u8
impl RootAssignRem<u64> for u8
sourcefn root_assign_rem(&mut self, exp: u64) -> u8
fn root_assign_rem(&mut self, exp: u64) -> u8
Replaces an integer with the floor of its $n$th root, and returns the remainder (the difference between the original integer and the $n$th power of the floor).
$f(x, n) = x - \lfloor\sqrt[n]{x}\rfloor^n$,
$x \gets \lfloor\sqrt[n]{x}\rfloor$.
Worst-case complexity
Constant time and additional memory.
Panics
Panics if exp
is zero.
Examples
See here.
type RemOutput = u8
sourceimpl RootAssignRem<u64> for u16
impl RootAssignRem<u64> for u16
sourcefn root_assign_rem(&mut self, exp: u64) -> u16
fn root_assign_rem(&mut self, exp: u64) -> u16
Replaces an integer with the floor of its $n$th root, and returns the remainder (the difference between the original integer and the $n$th power of the floor).
$f(x, n) = x - \lfloor\sqrt[n]{x}\rfloor^n$,
$x \gets \lfloor\sqrt[n]{x}\rfloor$.
Worst-case complexity
Constant time and additional memory.
Panics
Panics if exp
is zero.
Examples
See here.
type RemOutput = u16
sourceimpl RootAssignRem<u64> for u32
impl RootAssignRem<u64> for u32
sourcefn root_assign_rem(&mut self, exp: u64) -> u32
fn root_assign_rem(&mut self, exp: u64) -> u32
Replaces an integer with the floor of its $n$th root, and returns the remainder (the difference between the original integer and the $n$th power of the floor).
$f(x, n) = x - \lfloor\sqrt[n]{x}\rfloor^n$,
$x \gets \lfloor\sqrt[n]{x}\rfloor$.
Worst-case complexity
Constant time and additional memory.
Panics
Panics if exp
is zero.
Examples
See here.
type RemOutput = u32
sourceimpl RootAssignRem<u64> for u64
impl RootAssignRem<u64> for u64
sourcefn root_assign_rem(&mut self, exp: u64) -> u64
fn root_assign_rem(&mut self, exp: u64) -> u64
Replaces an integer with the floor of its $n$th root, and returns the remainder (the difference between the original integer and the $n$th power of the floor).
$f(x, n) = x - \lfloor\sqrt[n]{x}\rfloor^n$,
$x \gets \lfloor\sqrt[n]{x}\rfloor$.
Worst-case complexity
Constant time and additional memory.
Panics
Panics if exp
is zero.
Examples
See here.
type RemOutput = u64
sourceimpl RootAssignRem<u64> for u128
impl RootAssignRem<u64> for u128
sourcefn root_assign_rem(&mut self, exp: u64) -> u128
fn root_assign_rem(&mut self, exp: u64) -> u128
Replaces an integer with the floor of its $n$th root, and returns the remainder (the difference between the original integer and the $n$th power of the floor).
$f(x, n) = x - \lfloor\sqrt[n]{x}\rfloor^n$,
$x \gets \lfloor\sqrt[n]{x}\rfloor$.
Worst-case complexity
Constant time and additional memory.
Panics
Panics if exp
is zero.
Examples
See here.
type RemOutput = u128
sourceimpl RootAssignRem<u64> for usize
impl RootAssignRem<u64> for usize
sourcefn root_assign_rem(&mut self, exp: u64) -> usize
fn root_assign_rem(&mut self, exp: u64) -> usize
Replaces an integer with the floor of its $n$th root, and returns the remainder (the difference between the original integer and the $n$th power of the floor).
$f(x, n) = x - \lfloor\sqrt[n]{x}\rfloor^n$,
$x \gets \lfloor\sqrt[n]{x}\rfloor$.
Worst-case complexity
Constant time and additional memory.
Panics
Panics if exp
is zero.
Examples
See here.