pub struct ArbitraryFloatContext {
pub precision: Precision,
pub rounding: RoundingMode,
}Expand description
Context for arbitrary precision operations.
Provides a convenient way to perform multiple operations with the same precision and rounding mode.
Fields§
§precision: PrecisionDefault precision for operations.
rounding: RoundingModeDefault rounding mode.
Implementations§
Source§impl ArbitraryFloatContext
impl ArbitraryFloatContext
Sourcepub fn new(precision: Precision, rounding: RoundingMode) -> Self
pub fn new(precision: Precision, rounding: RoundingMode) -> Self
Create a new context with the given precision and rounding mode.
Sourcepub fn zero(&self) -> ArbitraryFloat
pub fn zero(&self) -> ArbitraryFloat
Create a zero value.
Sourcepub fn one(&self) -> ArbitraryFloat
pub fn one(&self) -> ArbitraryFloat
Create a one value.
Sourcepub fn from_f64(&self, value: f64) -> ArbitraryFloat
pub fn from_f64(&self, value: f64) -> ArbitraryFloat
Create from f64.
Sourcepub fn add(&self, a: &ArbitraryFloat, b: &ArbitraryFloat) -> ArbitraryFloat
pub fn add(&self, a: &ArbitraryFloat, b: &ArbitraryFloat) -> ArbitraryFloat
Add two values.
Sourcepub fn sub(&self, a: &ArbitraryFloat, b: &ArbitraryFloat) -> ArbitraryFloat
pub fn sub(&self, a: &ArbitraryFloat, b: &ArbitraryFloat) -> ArbitraryFloat
Subtract two values.
Sourcepub fn mul(&self, a: &ArbitraryFloat, b: &ArbitraryFloat) -> ArbitraryFloat
pub fn mul(&self, a: &ArbitraryFloat, b: &ArbitraryFloat) -> ArbitraryFloat
Multiply two values.
Sourcepub fn div(&self, a: &ArbitraryFloat, b: &ArbitraryFloat) -> ArbitraryFloat
pub fn div(&self, a: &ArbitraryFloat, b: &ArbitraryFloat) -> ArbitraryFloat
Divide two values.
Sourcepub fn sqrt(&self, a: &ArbitraryFloat) -> ArbitraryFloat
pub fn sqrt(&self, a: &ArbitraryFloat) -> ArbitraryFloat
Compute square root.
Trait Implementations§
Source§impl Clone for ArbitraryFloatContext
impl Clone for ArbitraryFloatContext
Source§fn clone(&self) -> ArbitraryFloatContext
fn clone(&self) -> ArbitraryFloatContext
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · 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 ArbitraryFloatContext
impl Debug for ArbitraryFloatContext
Auto Trait Implementations§
impl Freeze for ArbitraryFloatContext
impl RefUnwindSafe for ArbitraryFloatContext
impl Send for ArbitraryFloatContext
impl Sync for ArbitraryFloatContext
impl Unpin for ArbitraryFloatContext
impl UnsafeUnpin for ArbitraryFloatContext
impl UnwindSafe for ArbitraryFloatContext
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