pub struct Consts { /* private fields */ }Expand description
Constants cache contains arbitrary-precision mathematical constants.
Implementations§
Source§impl Consts
In an ideal situation, the Consts structure is initialized with Consts::new only once,
and then used where needed.
impl Consts
In an ideal situation, the Consts structure is initialized with Consts::new only once,
and then used where needed.
Sourcepub fn pi(&mut self, p: usize, rm: RoundingMode) -> ExactNum
pub fn pi(&mut self, p: usize, rm: RoundingMode) -> ExactNum
Returns the value of the pi number with precision p using rounding mode rm.
Precision is rounded upwards to the word size.
Sourcepub fn e(&mut self, p: usize, rm: RoundingMode) -> ExactNum
pub fn e(&mut self, p: usize, rm: RoundingMode) -> ExactNum
Returns the value of the Euler number with precision p using rounding mode rm.
Precision is rounded upwards to the word size.
Sourcepub fn ln_2(&mut self, p: usize, rm: RoundingMode) -> ExactNum
pub fn ln_2(&mut self, p: usize, rm: RoundingMode) -> ExactNum
Returns the value of the natural logarithm of 2 with precision p using rounding mode rm.
Precision is rounded upwards to the word size.
Sourcepub fn ln_10(&mut self, p: usize, rm: RoundingMode) -> ExactNum
pub fn ln_10(&mut self, p: usize, rm: RoundingMode) -> ExactNum
Returns the value of the natural logarithm of 10 with precision p using rounding mode rm.
Precision is rounded upwards to the word size.
Sourcepub fn cache_info(&self) -> ConstCacheInfo
pub fn cache_info(&self) -> ConstCacheInfo
How many bits of each series / extra constant are currently retained.
Sourcepub fn sqrt2(&mut self, p: usize, rm: RoundingMode) -> ExactNum
pub fn sqrt2(&mut self, p: usize, rm: RoundingMode) -> ExactNum
√2 with precision p using rounding mode rm.
Higher requests extend the cache; lower requests reuse it.
Sourcepub fn phi(&mut self, p: usize, rm: RoundingMode) -> ExactNum
pub fn phi(&mut self, p: usize, rm: RoundingMode) -> ExactNum
Golden ratio φ = (1+√5)/2 with precision p using rounding mode rm.
Higher requests extend the cache; lower requests reuse it.
Sourcepub fn euler_gamma(&mut self, p: usize, rm: RoundingMode) -> ExactNum
pub fn euler_gamma(&mut self, p: usize, rm: RoundingMode) -> ExactNum
Euler–Mascheroni constant γ with precision p using rounding mode rm.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Consts
impl RefUnwindSafe for Consts
impl Send for Consts
impl Sync for Consts
impl Unpin for Consts
impl UnsafeUnpin for Consts
impl UnwindSafe for Consts
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more