Struct mpmfnum::float::FloatContext
source · pub struct FloatContext { /* private fields */ }
Expand description
Rounding contexts for fixed-precision, floating-point numbers with unbounded exponent.
The associated storage type is Float
.
This is not IEEE 754 style rounding:
values rounded under this context are base-2 scientific numbers
(-1)^s * c * 2^exp
where c
is a fixed-precision unsigned integer
and exp
is an unbounded signed integer.
A FloatContext
is parameterized by
- maximum precision (see
Real::prec
), - rounding mode.
By default, the rounding mode is RoundingMode::NearestTiesToEven
.
This rounding context is similar to the one implemented by
Rug (MPFR).
Implementations§
source§impl FloatContext
impl FloatContext
sourcepub fn with_max_p(self, prec: usize) -> Self
pub fn with_max_p(self, prec: usize) -> Self
Sets the precision of this context.
sourcepub fn with_rm(self, rm: RoundingMode) -> Self
pub fn with_rm(self, rm: RoundingMode) -> Self
Sets the rounding mode of this context.
sourcepub fn rm(&self) -> RoundingMode
pub fn rm(&self) -> RoundingMode
Returns the rounding mode of this context.
Trait Implementations§
source§impl Clone for FloatContext
impl Clone for FloatContext
source§fn clone(&self) -> FloatContext
fn clone(&self) -> FloatContext
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresource§impl Debug for FloatContext
impl Debug for FloatContext
source§impl RoundedAbs for FloatContext
impl RoundedAbs for FloatContext
source§impl RoundedAcos for FloatContext
impl RoundedAcos for FloatContext
source§impl RoundedAcosh for FloatContext
impl RoundedAcosh for FloatContext
source§impl RoundedAdd for FloatContext
impl RoundedAdd for FloatContext
source§impl RoundedAsin for FloatContext
impl RoundedAsin for FloatContext
source§impl RoundedAsinh for FloatContext
impl RoundedAsinh for FloatContext
source§impl RoundedAtan for FloatContext
impl RoundedAtan for FloatContext
source§impl RoundedAtan2 for FloatContext
impl RoundedAtan2 for FloatContext
source§impl RoundedAtanh for FloatContext
impl RoundedAtanh for FloatContext
source§impl RoundedCbrt for FloatContext
impl RoundedCbrt for FloatContext
source§impl RoundedCos for FloatContext
impl RoundedCos for FloatContext
source§impl RoundedCosPi for FloatContext
impl RoundedCosPi for FloatContext
source§impl RoundedCosh for FloatContext
impl RoundedCosh for FloatContext
source§impl RoundedDiv for FloatContext
impl RoundedDiv for FloatContext
source§impl RoundedErf for FloatContext
impl RoundedErf for FloatContext
source§impl RoundedErfc for FloatContext
impl RoundedErfc for FloatContext
source§impl RoundedExp for FloatContext
impl RoundedExp for FloatContext
source§impl RoundedExp10m1 for FloatContext
impl RoundedExp10m1 for FloatContext
source§impl RoundedExp2 for FloatContext
impl RoundedExp2 for FloatContext
source§impl RoundedExp2m1 for FloatContext
impl RoundedExp2m1 for FloatContext
source§impl RoundedExpm1 for FloatContext
impl RoundedExpm1 for FloatContext
source§impl RoundedFMA for FloatContext
impl RoundedFMA for FloatContext
source§impl RoundedFmod for FloatContext
impl RoundedFmod for FloatContext
source§impl RoundedGamma for FloatContext
impl RoundedGamma for FloatContext
source§impl RoundedHypot for FloatContext
impl RoundedHypot for FloatContext
source§impl RoundedLgamma for FloatContext
impl RoundedLgamma for FloatContext
source§impl RoundedLog for FloatContext
impl RoundedLog for FloatContext
source§impl RoundedLog10 for FloatContext
impl RoundedLog10 for FloatContext
source§impl RoundedLog10p1 for FloatContext
impl RoundedLog10p1 for FloatContext
source§impl RoundedLog1p for FloatContext
impl RoundedLog1p for FloatContext
source§impl RoundedLog2 for FloatContext
impl RoundedLog2 for FloatContext
source§impl RoundedLog2p1 for FloatContext
impl RoundedLog2p1 for FloatContext
source§impl RoundedMul for FloatContext
impl RoundedMul for FloatContext
source§impl RoundedNeg for FloatContext
impl RoundedNeg for FloatContext
source§impl RoundedPow for FloatContext
impl RoundedPow for FloatContext
source§impl RoundedRecip for FloatContext
impl RoundedRecip for FloatContext
source§impl RoundedRecipSqrt for FloatContext
impl RoundedRecipSqrt for FloatContext
source§impl RoundedRemainder for FloatContext
impl RoundedRemainder for FloatContext
source§impl RoundedSin for FloatContext
impl RoundedSin for FloatContext
source§impl RoundedSinPi for FloatContext
impl RoundedSinPi for FloatContext
source§impl RoundedSinh for FloatContext
impl RoundedSinh for FloatContext
source§impl RoundedSqrt for FloatContext
impl RoundedSqrt for FloatContext
source§impl RoundedSub for FloatContext
impl RoundedSub for FloatContext
source§impl RoundedTan for FloatContext
impl RoundedTan for FloatContext
source§impl RoundedTanPi for FloatContext
impl RoundedTanPi for FloatContext
source§impl RoundedTanh for FloatContext
impl RoundedTanh for FloatContext
source§impl RoundingContext for FloatContext
impl RoundingContext for FloatContext
Auto Trait Implementations§
impl RefUnwindSafe for FloatContext
impl Send for FloatContext
impl Sync for FloatContext
impl Unpin for FloatContext
impl UnwindSafe for FloatContext
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
Mutably borrows from an owned value. Read more
source§impl<T> CheckedAs for T
impl<T> CheckedAs for T
source§fn checked_as<Dst>(self) -> Option<Dst>where
T: CheckedCast<Dst>,
fn checked_as<Dst>(self) -> Option<Dst>where
T: CheckedCast<Dst>,
Casts the value.
source§impl<Src, Dst> CheckedCastFrom<Src> for Dstwhere
Src: CheckedCast<Dst>,
impl<Src, Dst> CheckedCastFrom<Src> for Dstwhere
Src: CheckedCast<Dst>,
source§fn checked_cast_from(src: Src) -> Option<Dst>
fn checked_cast_from(src: Src) -> Option<Dst>
Casts the value.
source§impl<T> OverflowingAs for T
impl<T> OverflowingAs for T
source§fn overflowing_as<Dst>(self) -> (Dst, bool)where
T: OverflowingCast<Dst>,
fn overflowing_as<Dst>(self) -> (Dst, bool)where
T: OverflowingCast<Dst>,
Casts the value.
source§impl<Src, Dst> OverflowingCastFrom<Src> for Dstwhere
Src: OverflowingCast<Dst>,
impl<Src, Dst> OverflowingCastFrom<Src> for Dstwhere
Src: OverflowingCast<Dst>,
source§fn overflowing_cast_from(src: Src) -> (Dst, bool)
fn overflowing_cast_from(src: Src) -> (Dst, bool)
Casts the value.
source§impl<T> SaturatingAs for T
impl<T> SaturatingAs for T
source§fn saturating_as<Dst>(self) -> Dstwhere
T: SaturatingCast<Dst>,
fn saturating_as<Dst>(self) -> Dstwhere
T: SaturatingCast<Dst>,
Casts the value.
source§impl<Src, Dst> SaturatingCastFrom<Src> for Dstwhere
Src: SaturatingCast<Dst>,
impl<Src, Dst> SaturatingCastFrom<Src> for Dstwhere
Src: SaturatingCast<Dst>,
source§fn saturating_cast_from(src: Src) -> Dst
fn saturating_cast_from(src: Src) -> Dst
Casts the value.
source§impl<T> UnwrappedAs for T
impl<T> UnwrappedAs for T
source§fn unwrapped_as<Dst>(self) -> Dstwhere
T: UnwrappedCast<Dst>,
fn unwrapped_as<Dst>(self) -> Dstwhere
T: UnwrappedCast<Dst>,
Casts the value.
source§impl<Src, Dst> UnwrappedCastFrom<Src> for Dstwhere
Src: UnwrappedCast<Dst>,
impl<Src, Dst> UnwrappedCastFrom<Src> for Dstwhere
Src: UnwrappedCast<Dst>,
source§fn unwrapped_cast_from(src: Src) -> Dst
fn unwrapped_cast_from(src: Src) -> Dst
Casts the value.
source§impl<T> WrappingAs for T
impl<T> WrappingAs for T
source§fn wrapping_as<Dst>(self) -> Dstwhere
T: WrappingCast<Dst>,
fn wrapping_as<Dst>(self) -> Dstwhere
T: WrappingCast<Dst>,
Casts the value.
source§impl<Src, Dst> WrappingCastFrom<Src> for Dstwhere
Src: WrappingCast<Dst>,
impl<Src, Dst> WrappingCastFrom<Src> for Dstwhere
Src: WrappingCast<Dst>,
source§fn wrapping_cast_from(src: Src) -> Dst
fn wrapping_cast_from(src: Src) -> Dst
Casts the value.