Trait malachite_base::num::arithmetic::traits::CeilingRoot
source · pub trait CeilingRoot<POW> {
type Output;
// Required method
fn ceiling_root(self, pow: POW) -> Self::Output;
}
Expand description
Finds the ceiling of the $n$th root of a number.
Required Associated Types§
Required Methods§
fn ceiling_root(self, pow: POW) -> Self::Output
Implementations on Foreign Types§
source§impl CeilingRoot<u64> for i8
impl CeilingRoot<u64> for i8
source§impl CeilingRoot<u64> for i16
impl CeilingRoot<u64> for i16
source§impl CeilingRoot<u64> for i32
impl CeilingRoot<u64> for i32
source§impl CeilingRoot<u64> for i64
impl CeilingRoot<u64> for i64
source§impl CeilingRoot<u64> for i128
impl CeilingRoot<u64> for i128
source§impl CeilingRoot<u64> for isize
impl CeilingRoot<u64> for isize
source§impl CeilingRoot<u64> for u8
impl CeilingRoot<u64> for u8
source§impl CeilingRoot<u64> for u16
impl CeilingRoot<u64> for u16
source§impl CeilingRoot<u64> for u32
impl CeilingRoot<u64> for u32
source§fn ceiling_root(self, exp: u64) -> u32
fn ceiling_root(self, exp: u64) -> u32
Returns the ceiling of the $n$th root of a u32
.
$f(x, n) = \lceil\sqrt[n]{x}\rceil$.
§Worst-case complexity
Constant time and additional memory.
§Panics
Panics if exp
is zero.
§Examples
See here.
§Notes
For cube roots, the u32
implementation uses a piecewise Chebyshev approximation. For
other roots, it uses Newton’s method. In both implementations, the result of these
approximations is adjusted afterwards to account for error.
type Output = u32
source§impl CeilingRoot<u64> for u64
impl CeilingRoot<u64> for u64
source§fn ceiling_root(self, exp: u64) -> u64
fn ceiling_root(self, exp: u64) -> u64
Returns the ceiling of the $n$th root of a u64
.
$f(x, n) = \lceil\sqrt[n]{x}\rceil$.
§Worst-case complexity
Constant time and additional memory.
§Panics
Panics if exp
is zero.
§Examples
See here.
§Notes
For cube roots, the u64
implementation uses a piecewise Chebyshev approximation. For
other roots, it uses Newton’s method. In both implementations, the result of these
approximations is adjusted afterwards to account for error.
type Output = u64
source§impl CeilingRoot<u64> for u128
impl CeilingRoot<u64> for u128
source§fn ceiling_root(self, exp: u64) -> u128
fn ceiling_root(self, exp: u64) -> u128
Returns the ceiling of the $n$th root of a u128
.
$f(x, n) = \lceil\sqrt[n]{x}\rceil$.
§Worst-case complexity
Constant time and additional memory.
§Panics
Panics if exp
is zero.
§Examples
See here.
§Notes
The u128
implementation computes the root using floating-point arithmetic. The
approximate result is adjusted afterwards to account for error.