Struct astro_float::Consts
source · pub struct Consts { /* private fields */ }
Expand description
Constants cache contains arbitrary-precision mathematical constants.
Implementations§
source§impl 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
using rounding mode rm
.
Precision is rounded upwards to the word size.
Errors
- MemoryAllocation: failed to allocate memory for mantissa.
- InvalidArgument: the 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
using rounding mode rm
.
Precision is rounded upwards to the word size.
Errors
- MemoryAllocation: failed to allocate memory for mantissa.
- InvalidArgument: the 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
using rounding mode rm
.
Precision is rounded upwards to the word size.
Errors
- MemoryAllocation: failed to allocate memory for mantissa.
- InvalidArgument: the 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
.
Precision is rounded upwards to the word size.
Errors
- MemoryAllocation: failed to allocate memory for mantissa.
- InvalidArgument: the precision is incorrect.