Struct astro_float::Consts
source · [−]pub struct Consts { /* private fields */ }
Expand description
Constants cache contains arbitrary-precision mathematical constants.
Implementations
sourceimpl Consts
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) -> Result<BigFloatNumber, Error>
pub fn pi(&mut self, p: usize, rm: RoundingMode) -> Result<BigFloatNumber, Error>
Returns the value of the pi number with precision p
.
Errors
- MemoryAllocation: failed to allocate memory for mantissa.
- InvalidArgument: precision is incorrect.
sourcepub fn e(&mut self, p: usize, rm: RoundingMode) -> Result<BigFloatNumber, Error>
pub fn e(&mut self, p: usize, rm: RoundingMode) -> Result<BigFloatNumber, Error>
Returns the value of the Euler number with precision p
.
Errors
- MemoryAllocation: failed to allocate memory for mantissa.
- InvalidArgument: precision is incorrect.
sourcepub fn ln_2(
&mut self,
p: usize,
rm: RoundingMode
) -> Result<BigFloatNumber, Error>
pub fn ln_2(
&mut self,
p: usize,
rm: RoundingMode
) -> Result<BigFloatNumber, Error>
Returns the value of the natural logarithm of 2 with precision p
.
Errors
- MemoryAllocation: failed to allocate memory for mantissa.
- InvalidArgument: precision is incorrect.
sourcepub fn ln_10(
&mut self,
p: usize,
rm: RoundingMode
) -> Result<BigFloatNumber, Error>
pub fn ln_10(
&mut self,
p: usize,
rm: RoundingMode
) -> Result<BigFloatNumber, Error>
Returns the value of the natural logarithm of 10 with precision p
using rounding mode rm
.
Errors
- MemoryAllocation: failed to allocate memory for mantissa.
- InvalidArgument: precision is incorrect.
Auto Trait Implementations
impl RefUnwindSafe for Consts
impl Send for Consts
impl Sync for Consts
impl Unpin for Consts
impl UnwindSafe for Consts
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more