Struct dec::Context [−][src]
A context for performing decimal operations.
Contexts serve two purposes:
-
They configure various properties of decimal arithmetic, like the rounding algorithm to use.
-
They accumulate any informational and exceptional conditions raised by decimal operations. Multiple operations can be performed on a context and the status need only be checked once at the end. This can improve performance when performing many decimal operations.
A given context is only valid for use with one decimal type, specified by
the D
type parameter.
Not all context types support all operations. For example, only the
context for the arbitrary-precision decimal type Decimal
supports
configuring precision.
Implementations
impl<D> Context<D>
[src]
pub fn rounding(&self) -> Rounding
[src]
Returns the context's rounding algorithm.
pub fn set_rounding(&mut self, rounding: Rounding)
[src]
Set's the context's rounding algorithm.
pub fn status(&self) -> Status
[src]
Returns the context's status.
pub fn clear_status(&mut self)
[src]
Clears the context's status.
impl<const N: usize> Context<Decimal<N>>
[src]
pub fn precision(&self) -> usize
[src]
arbitrary-precision
only.Returns the context's precision.
Operations that use this context will be rounded to this length if necessary.
pub fn set_precision(
&mut self,
precision: usize
) -> Result<(), InvalidPrecisionError>
[src]
&mut self,
precision: usize
) -> Result<(), InvalidPrecisionError>
arbitrary-precision
only.Sets the context's precision.
The precision must be greater than one and no greater than N * 3
.
pub fn clamp(&self) -> bool
[src]
arbitrary-precision
only.Reports whether the context has exponent clamping enabled.
See the clamp
field in the documentation of libdecnumber's
decContext module for details.
pub fn set_clamp(&mut self, clamp: bool)
[src]
arbitrary-precision
only.Sets whether the context has exponent clamping enabled.
pub fn max_exponent(&self) -> isize
[src]
arbitrary-precision
only.Returns the context's maximum exponent.
See the emax
field in the documentation of libdecnumber's
decContext module for details.
pub fn set_max_exponent(&mut self, e: isize) -> Result<(), InvalidExponentError>
[src]
arbitrary-precision
only.Sets the context's maximum exponent.
The maximum exponent must not be negative and no greater than 999,999,999.
pub fn min_exponent(&self) -> isize
[src]
arbitrary-precision
only.Returns the context's minimum exponent.
See the emin
field in the documentation of libdecnumber's
decContext module for details.
pub fn set_min_exponent(&mut self, e: isize) -> Result<(), InvalidExponentError>
[src]
arbitrary-precision
only.Sets the context's minimum exponent.
The minimum exponent must not be positive and no smaller than -999,999,999.
pub fn parse<S>(&mut self, s: S) -> Result<Decimal<N>, ParseDecimalError> where
S: Into<Vec<u8>>,
[src]
S: Into<Vec<u8>>,
arbitrary-precision
only.Parses a number from its string representation.
pub fn class(&mut self, n: &Decimal<N>) -> Class
[src]
arbitrary-precision
only.Classifies the number.
pub fn abs(&mut self, n: &mut Decimal<N>)
[src]
arbitrary-precision
only.Computes the absolute value of n
, storing the result in n
.
This has the same effect as Context::<Decimal<N>>::plus
unless
n
is negative, in which case it has the same effect as
Context::<Decimal<N>>::minus
.
pub fn add(&mut self, lhs: &mut Decimal<N>, rhs: &Decimal<N>)
[src]
arbitrary-precision
only.Adds lhs
and rhs
, storing the result in lhs
.
pub fn and(&mut self, lhs: &mut Decimal<N>, rhs: &Decimal<N>)
[src]
arbitrary-precision
only.Carries out the digitwise logical and of lhs
and rhs
, storing
the result in lhs
.
pub fn div(&mut self, lhs: &mut Decimal<N>, rhs: &Decimal<N>)
[src]
arbitrary-precision
only.Divides lhs
by rhs
, storing the result in lhs
.
pub fn div_integer(&mut self, lhs: &mut Decimal<N>, rhs: &Decimal<N>)
[src]
arbitrary-precision
only.Divides lhs
by rhs
, storing the integer part of the result in lhs
.
pub fn exp(&mut self, n: &mut Decimal<N>)
[src]
arbitrary-precision
only.Raises e to the power of n
, storing the result in n
.
pub fn fma(&mut self, x: &mut Decimal<N>, y: &Decimal<N>, z: &Decimal<N>)
[src]
arbitrary-precision
only.Calculates the fused multiply-add (x * y) + z
and stores the result
in x
.
The multiplication is carried out first and is exact, so this operation only has the one, final rounding.
pub fn invert(&mut self, n: &mut Decimal<N>)
[src]
arbitrary-precision
only.Computes the digitwise logical inversion of n
, storing the result in
n
.
pub fn ln(&mut self, n: &mut Decimal<N>)
[src]
arbitrary-precision
only.Computes the natural logarithm of n
, storing the result in n
.
pub fn log10(&mut self, n: &mut Decimal<N>)
[src]
arbitrary-precision
only.Computes the base-10 logarithm of n
, storing the result in n
.
pub fn logb(&mut self, n: &mut Decimal<N>)
[src]
arbitrary-precision
only.Computes the adjusted exponent of the number, according to IEEE 754 rules.
pub fn max(&mut self, lhs: &mut Decimal<N>, rhs: &Decimal<N>)
[src]
arbitrary-precision
only.Places whichever of lhs
and rhs
is larger in lhs
.
The comparison is performed using the same rules as for
total_cmp
.
pub fn max_abs(&mut self, lhs: &mut Decimal<N>, rhs: &Decimal<N>)
[src]
arbitrary-precision
only.Places whichever of lhs
and rhs
has the larger absolute value in
lhs
.
pub fn min(&mut self, lhs: &mut Decimal<N>, rhs: &Decimal<N>)
[src]
arbitrary-precision
only.Places whichever of lhs
and rhs
is smaller in lhs
.
The comparison is performed using the same rules as for
total_cmp
.
pub fn min_abs(&mut self, lhs: &mut Decimal<N>, rhs: &Decimal<N>)
[src]
arbitrary-precision
only.Places whichever of lhs
and rhs
has the smaller absolute value in
lhs
.
pub fn minus(&mut self, n: &mut Decimal<N>)
[src]
arbitrary-precision
only.Subtracts n
from zero, storing the result in n
.
pub fn mul(&mut self, lhs: &mut Decimal<N>, rhs: &Decimal<N>)
[src]
arbitrary-precision
only.Multiples lhs
by rhs
, storing the result in lhs
.
pub fn next_minus(&mut self, n: &mut Decimal<N>)
[src]
arbitrary-precision
only.Computes the next number to n
in the direction of negative infinity,
storing the result in n
.
This operation is a generalization of the IEEE 754 nextDown operation.
pub fn next_plus(&mut self, n: &mut Decimal<N>)
[src]
arbitrary-precision
only.Computes the next number to n
in the direction of positive infinity,
storing the result in n
.
This operation is a generalization of the IEEE 754 nextUp operation.
pub fn next_toward(&mut self, x: &mut Decimal<N>, y: &Decimal<N>)
[src]
arbitrary-precision
only.Computes the next number to x
in the direction of y
, storing the
result in x
.
This operation is a generalization of the IEEE 754 nextAfter operation.
pub fn or(&mut self, lhs: &mut Decimal<N>, rhs: &Decimal<N>)
[src]
arbitrary-precision
only.Carries out the digitwise logical or of lhs
and rhs
, storing
the result in lhs
.
pub fn partial_cmp(
&mut self,
lhs: &Decimal<N>,
rhs: &Decimal<N>
) -> Option<Ordering>
[src]
&mut self,
lhs: &Decimal<N>,
rhs: &Decimal<N>
) -> Option<Ordering>
arbitrary-precision
only.Determines the ordering of lhs
relative to rhs
, using a partial
order.
If either lhs
or rhs
is a NaN, returns None
. To force an ordering
upon NaNs, use total_cmp
.
pub fn plus(&mut self, n: &mut Decimal<N>)
[src]
arbitrary-precision
only.Adds n
to zero, storing the result in n
.
pub fn pow(&mut self, x: &mut Decimal<N>, y: &Decimal<N>)
[src]
arbitrary-precision
only.Raises x
to the power of y
, storing the result in x
.
pub fn quantize(&mut self, lhs: &mut Decimal<N>, rhs: &Decimal<N>)
[src]
arbitrary-precision
only.Rounds or pads lhs
so that it has the same exponent as rhs
, storing
the result in lhs
.
pub fn reduce(&mut self, n: &mut Decimal<N>)
[src]
arbitrary-precision
only.Reduces n
's coefficient to its shortest possible form without
changing the value of the result, storing the result in n
.
pub fn rem(&mut self, lhs: &mut Decimal<N>, rhs: &Decimal<N>)
[src]
arbitrary-precision
only.Integer-divides lhs
by rhs
, storing the remainder in lhs
.
pub fn rem_near(&mut self, lhs: &mut Decimal<N>, rhs: &Decimal<N>)
[src]
arbitrary-precision
only.Like rem
, but uses the IEEE 754
rules for remainder operations.
pub fn shift(&mut self, lhs: &mut Decimal<N>, rhs: &Decimal<N>)
[src]
arbitrary-precision
only.Shifts the digits of lhs
by rhs
, storing the result in lhs
.
If rhs
is positive, shifts to the left. If rhs
is negative, shifts
to the right. Any digits "shifted in" will be zero.
rhs
specifies the number of positions to shift, and must be a finite
integer.
pub fn rotate(&mut self, lhs: &mut Decimal<N>, rhs: &Decimal<N>)
[src]
arbitrary-precision
only.Rotates the digits of lhs
by rhs
, storing the result in lhs
.
If rhs
is positive, rotates to the left. If rhs
is negative, rotates
to the right.
rhs
specifies the number of positions to rotate, and must be a finite
integer.
pub fn scaleb(&mut self, x: &mut Decimal<N>, y: &Decimal<N>)
[src]
arbitrary-precision
only.Multiplies x
by 10y
, storing the result in x
.
pub fn sqrt(&mut self, n: &mut Decimal<N>)
[src]
arbitrary-precision
only.Computes the square root of n
, storing the result in n
.
pub fn sub(&mut self, lhs: &mut Decimal<N>, rhs: &Decimal<N>)
[src]
arbitrary-precision
only.Subtracts rhs
from lhs
, storing the result in lhs
.
pub fn total_cmp(&mut self, lhs: &Decimal<N>, rhs: &Decimal<N>) -> Ordering
[src]
arbitrary-precision
only.Determines the ordering of lhs
relative to rhs
, using the
total order predicate defined in IEEE 754-2008.
For a brief description of the ordering, consult f32::total_cmp
.
pub fn xor(&mut self, lhs: &mut Decimal<N>, rhs: &Decimal<N>)
[src]
arbitrary-precision
only.Carries out the digitwise logical xor of lhs
and rhs
, storing
the result in lhs
.
impl Context<Decimal128>
[src]
pub fn parse<S>(&mut self, s: S) -> Result<Decimal128, ParseDecimalError> where
S: Into<Vec<u8>>,
[src]
S: Into<Vec<u8>>,
Parses a number from its string representation.
pub fn from_decimal<const N: usize>(&mut self, d: &Decimal<N>) -> Decimal128
[src]
Constructs a number from an arbitrary-precision decimal.
The result may be inexact. The status fields on the context will be set appropriately if so.
pub fn abs(&mut self, mut n: Decimal128) -> Decimal128
[src]
Computes the absolute value of n
.
This has the same effect as Context::<Decimal128>::plus
unless
n
is negative, in which case it has the same effect as
Context::<Decimal128>::minus
.
The returned result will be canonical.
pub fn add(&mut self, mut lhs: Decimal128, rhs: Decimal128) -> Decimal128
[src]
Adds lhs
and rhs
.
pub fn and(&mut self, mut lhs: Decimal128, rhs: Decimal128) -> Decimal128
[src]
Carries out the digitwise logical and of lhs
and rhs
.
The operands must be valid for logical operations.
See Decimal128::is_logical
.
pub fn div(&mut self, mut lhs: Decimal128, rhs: Decimal128) -> Decimal128
[src]
Divides lhs
by rhs
.
pub fn div_integer(
&mut self,
mut lhs: Decimal128,
rhs: Decimal128
) -> Decimal128
[src]
&mut self,
mut lhs: Decimal128,
rhs: Decimal128
) -> Decimal128
Divides lhs
by rhs
and returns the integer part of the result
(rounded towards zero) with an exponent of 0.
If the result would overflow, then Status::division_impossible
is
set.
pub fn fma(
&mut self,
mut x: Decimal128,
y: Decimal128,
z: Decimal128
) -> Decimal128
[src]
&mut self,
mut x: Decimal128,
y: Decimal128,
z: Decimal128
) -> Decimal128
Calculates the fused multiply-add (x * y) + z
.
The multiplication is carried out first and is exact, so this operation only has the one, final rounding.
pub fn invert(&mut self, mut n: Decimal128) -> Decimal128
[src]
Carries out the digitwise logical inversion of n
.
The operand must be valid for logical operation.
See Decimal128::is_logical
.
pub fn logb(&mut self, mut n: Decimal128) -> Decimal128
[src]
Computes the adjusted exponent of the number, according to IEEE 754 rules.
pub fn max(&mut self, mut lhs: Decimal128, rhs: Decimal128) -> Decimal128
[src]
Returns whichever of lhs
and rhs
is larger.
The comparison is performed using the same rules as for
Decimal128::total_cmp
.
pub fn max_abs(&mut self, mut lhs: Decimal128, rhs: Decimal128) -> Decimal128
[src]
Returns whichever of lhs
and rhs
has the largest absolute value.
pub fn min(&mut self, mut lhs: Decimal128, rhs: Decimal128) -> Decimal128
[src]
Returns whichever of lhs
and rhs
is smaller.
The comparison is performed using the same rules as for
Decimal128::total_cmp
.
pub fn min_abs(&mut self, mut lhs: Decimal128, rhs: Decimal128) -> Decimal128
[src]
Returns whichever of lhs
and rhs
has the largest absolute value.
pub fn minus(&mut self, mut n: Decimal128) -> Decimal128
[src]
Subtracts n
from zero.
pub fn mul(&mut self, mut lhs: Decimal128, rhs: Decimal128) -> Decimal128
[src]
Divides lhs
by rhs
.
pub fn next_minus(&mut self, mut n: Decimal128) -> Decimal128
[src]
Returns the next number to n
in the direction of negative infinity.
This operation follows the IEEE 754 rules for the nextDown operation.
pub fn next_plus(&mut self, mut n: Decimal128) -> Decimal128
[src]
Returns the next number to n
in the direction of positive infinity.
This operation follows the IEEE 754 rules for the nextUp operation.
pub fn next_toward(&mut self, mut x: Decimal128, y: Decimal128) -> Decimal128
[src]
Returns the next number to x
in the direction of y
.
This operation follows the IEEE 754 rules for the nextAfter operation.
pub fn partial_cmp(
&mut self,
lhs: Decimal128,
rhs: Decimal128
) -> Option<Ordering>
[src]
&mut self,
lhs: Decimal128,
rhs: Decimal128
) -> Option<Ordering>
Determines the ordering of lhs
relative to rhs
, using a partial
order.
If either lhs
or rhs
is a NaN, returns None
. To force an ordering
upon NaNs, use Decimal128::total_cmp
.
pub fn plus(&mut self, mut n: Decimal128) -> Decimal128
[src]
Adds n
to zero.
pub fn quantize(&mut self, mut lhs: Decimal128, rhs: Decimal128) -> Decimal128
[src]
Rounds or pads lhs
so that it has the same exponent as rhs
.
pub fn reduce(&mut self, mut n: Decimal128) -> Decimal128
[src]
Reduces the number's coefficient to its shortest possible form without changing the value of the result.
This removes all possible trailing zeros; some may remain when the number is very close to the most positive or most negative number.
pub fn rem(&mut self, mut lhs: Decimal128, rhs: Decimal128) -> Decimal128
[src]
Integer-divides lhs
by rhs
and returns the remainder from the
division.
pub fn rem_near(&mut self, mut lhs: Decimal128, rhs: Decimal128) -> Decimal128
[src]
Like rem
, but uses the IEEE 754
rules for remainder operations.
pub fn rotate(&mut self, mut lhs: Decimal128, rhs: Decimal128) -> Decimal128
[src]
Rotates the digits of lhs
by rhs
.
If rhs
is positive, rotates to the left. If rhs
is negative, rotates
to the right.
rhs
specifies the number of positions to rotate, and must be a finite
integer. NaNs are propagated as usual.
If lhs
is infinity, the result is infinity of the same sign.
pub fn round(&mut self, mut n: Decimal128) -> Decimal128
[src]
Rounds the number to an integral value using the rounding mode in the context.
pub fn scaleb(&mut self, mut x: Decimal128, y: Decimal128) -> Decimal128
[src]
Multiplies x
by 10y
.
pub fn shift(&mut self, mut lhs: Decimal128, rhs: Decimal128) -> Decimal128
[src]
Shifts the digits of lhs
by rhs
.
If rhs
is positive, shifts to the left. If rhs
is negative, shifts
to the right. Any digits "shifted in" will be zero.
rhs
specifies the number of positions to shift, and must be a finite
integer. NaNs are propagated as usual.
If lhs
is infinity, the result is infinity of the same sign.
pub fn sub(&mut self, mut lhs: Decimal128, rhs: Decimal128) -> Decimal128
[src]
Subtracts rhs
from lhs
.
pub fn or(&mut self, mut lhs: Decimal128, rhs: Decimal128) -> Decimal128
[src]
Carries out the digitwise logical or of lhs
and rhs
.
The operands must be valid for logical operations.
See Decimal128::is_logical
.
pub fn xor(&mut self, mut lhs: Decimal128, rhs: Decimal128) -> Decimal128
[src]
Carries out the digitwise logical exclusive or of lhs
and rhs
.
The operands must be valid for logical operations.
See Decimal128::is_logical
.
impl Context<Decimal32>
[src]
pub fn parse<S>(&mut self, s: S) -> Result<Decimal32, ParseDecimalError> where
S: Into<Vec<u8>>,
[src]
S: Into<Vec<u8>>,
Parses a number from its string representation.
pub fn from_decimal64(&mut self, d64: Decimal64) -> Decimal32
[src]
Constructs a number from a 64-bit decimal float.
The result may be inexact. The status fields on the context will be set appropriately if so.
pub fn from_decimal<const N: usize>(&mut self, d: &Decimal<N>) -> Decimal32
[src]
Constructs a number from an arbitrary-precision decimal.
The result may be inexact. The status fields on the context will be set appropriately if so.
impl Context<Decimal64>
[src]
pub fn parse<S>(&mut self, s: S) -> Result<Decimal64, ParseDecimalError> where
S: Into<Vec<u8>>,
[src]
S: Into<Vec<u8>>,
Parses a number from its string representation.
pub fn from_decimal128(&mut self, d128: Decimal128) -> Decimal64
[src]
Constructs a number from a 128-bit decimal float.
The result may be inexact. The status fields on the context will be set appropriately if so.
pub fn from_decimal<const N: usize>(&mut self, d: &Decimal<N>) -> Decimal64
[src]
Constructs a number from an arbitrary-precision decimal.
The result may be inexact. The status fields on the context will be set appropriately if so.
pub fn abs(&mut self, mut n: Decimal64) -> Decimal64
[src]
Computes the absolute value of n
.
This has the same effect as Context::<Decimal64>::plus
unless
n
is negative, in which case it has the same effect as
Context::<Decimal64>::minus
.
The returned result will be canonical.
pub fn add(&mut self, mut lhs: Decimal64, rhs: Decimal64) -> Decimal64
[src]
Adds lhs
and rhs
.
pub fn and(&mut self, mut lhs: Decimal64, rhs: Decimal64) -> Decimal64
[src]
Carries out the digitwise logical and of lhs
and rhs
.
The operands must be valid for logical operations.
See Decimal64::is_logical
.
pub fn div(&mut self, mut lhs: Decimal64, rhs: Decimal64) -> Decimal64
[src]
Divides lhs
by rhs
.
pub fn div_integer(&mut self, mut lhs: Decimal64, rhs: Decimal64) -> Decimal64
[src]
Divides lhs
by rhs
and returns the integer part of the result
(rounded towards zero) with an exponent of 0.
If the result would overflow, then Status::division_impossible
is
set.
pub fn fma(&mut self, mut x: Decimal64, y: Decimal64, z: Decimal64) -> Decimal64
[src]
Calculates the fused multiply-add (x * y) + z
.
The multiplication is carried out first and is exact, so this operation only has the one, final rounding.
pub fn invert(&mut self, mut n: Decimal64) -> Decimal64
[src]
Carries out the digitwise logical inversion of n
.
The operand must be valid for logical operation.
See Decimal64::is_logical
.
pub fn logb(&mut self, mut n: Decimal64) -> Decimal64
[src]
Computes the adjusted exponent of the number, according to IEEE 754 rules.
pub fn max(&mut self, mut lhs: Decimal64, rhs: Decimal64) -> Decimal64
[src]
Returns whichever of lhs
and rhs
is larger.
The comparison is performed using the same rules as for
Decimal64::total_cmp
.
pub fn max_abs(&mut self, mut lhs: Decimal64, rhs: Decimal64) -> Decimal64
[src]
Returns whichever of lhs
and rhs
has the largest absolute value.
pub fn min(&mut self, mut lhs: Decimal64, rhs: Decimal64) -> Decimal64
[src]
Returns whichever of lhs
and rhs
is smaller.
The comparison is performed using the same rules as for
Decimal64::total_cmp
.
pub fn min_abs(&mut self, mut lhs: Decimal64, rhs: Decimal64) -> Decimal64
[src]
Returns whichever of lhs
and rhs
has the largest absolute value.
pub fn minus(&mut self, mut n: Decimal64) -> Decimal64
[src]
Subtracts n
from zero.
pub fn mul(&mut self, mut lhs: Decimal64, rhs: Decimal64) -> Decimal64
[src]
Divides lhs
by rhs
.
pub fn next_minus(&mut self, mut n: Decimal64) -> Decimal64
[src]
Returns the next number to n
in the direction of negative infinity.
This operation follows the IEEE 754 rules for the nextDown operation.
pub fn next_plus(&mut self, mut n: Decimal64) -> Decimal64
[src]
Returns the next number to n
in the direction of positive infinity.
This operation follows the IEEE 754 rules for the nextUp operation.
pub fn next_toward(&mut self, mut x: Decimal64, y: Decimal64) -> Decimal64
[src]
Returns the next number to x
in the direction of y
.
This operation follows the IEEE 754 rules for the nextAfter operation.
pub fn partial_cmp(
&mut self,
lhs: Decimal64,
rhs: Decimal64
) -> Option<Ordering>
[src]
&mut self,
lhs: Decimal64,
rhs: Decimal64
) -> Option<Ordering>
Determines the ordering of lhs
relative to rhs
, using a partial
order.
If either lhs
or rhs
is a NaN, returns None
. To force an ordering
upon NaNs, use Decimal64::total_cmp
or
OrderedDecimal
.
pub fn plus(&mut self, mut n: Decimal64) -> Decimal64
[src]
Adds n
to zero.
pub fn quantize(&mut self, mut lhs: Decimal64, rhs: Decimal64) -> Decimal64
[src]
Rounds or pads lhs
so that it has the same exponent as rhs
.
pub fn reduce(&mut self, mut n: Decimal64) -> Decimal64
[src]
Reduces the number's coefficient to its shortest possible form without changing the value of the result.
This removes all possible trailing zeros; some may remain when the number is very close to the most positive or most negative number.
pub fn rem(&mut self, mut lhs: Decimal64, rhs: Decimal64) -> Decimal64
[src]
Integer-divides lhs
by rhs
and returns the remainder from the
division.
pub fn rem_near(&mut self, mut lhs: Decimal64, rhs: Decimal64) -> Decimal64
[src]
Like rem
, but uses the IEEE 754
rules for remainder operations.
pub fn rotate(&mut self, mut lhs: Decimal64, rhs: Decimal64) -> Decimal64
[src]
Rotates the digits of lhs
by rhs
.
If rhs
is positive, rotates to the left. If rhs
is negative, rotates
to the right.
rhs
specifies the number of positions to rotate, and must be a finite
integer. NaNs are propagated as usual.
If lhs
is infinity, the result is infinity of the same sign.
pub fn round(&mut self, mut n: Decimal64) -> Decimal64
[src]
Rounds the number to an integral value using the rounding mode in the context.
pub fn scaleb(&mut self, mut x: Decimal64, y: Decimal64) -> Decimal64
[src]
Multiplies x
by 10y
.
pub fn shift(&mut self, mut lhs: Decimal64, rhs: Decimal64) -> Decimal64
[src]
Shifts the digits of lhs
by rhs
.
If rhs
is positive, shifts to the left. If rhs
is negative, shifts
to the right. Any digits "shifted in" will be zero.
rhs
specifies the number of positions to shift, and must be a finite
integer. NaNs are propagated as usual.
If lhs
is infinity, the result is infinity of the same sign.
pub fn sub(&mut self, mut lhs: Decimal64, rhs: Decimal64) -> Decimal64
[src]
Subtracts rhs
from lhs
.
pub fn or(&mut self, mut lhs: Decimal64, rhs: Decimal64) -> Decimal64
[src]
Carries out the digitwise logical or of lhs
and rhs
.
The operands must be valid for logical operations.
See Decimal64::is_logical
.
pub fn xor(&mut self, mut lhs: Decimal64, rhs: Decimal64) -> Decimal64
[src]
Carries out the digitwise logical exclusive or of lhs
and rhs
.
The operands must be valid for logical operations.
See Decimal64::is_logical
.
Trait Implementations
impl<D: Clone> Clone for Context<D>
[src]
impl<D> Debug for Context<D>
[src]
impl<const N: usize> Default for Context<Decimal<N>>
[src]
arbitrary-precision
only.impl Default for Context<Decimal128>
[src]
fn default() -> Context<Decimal128>
[src]
impl Default for Context<Decimal32>
[src]
impl Default for Context<Decimal64>
[src]
Auto Trait Implementations
impl<D> RefUnwindSafe for Context<D> where
D: RefUnwindSafe,
[src]
D: RefUnwindSafe,
impl<D> Send for Context<D> where
D: Send,
[src]
D: Send,
impl<D> Sync for Context<D> where
D: Sync,
[src]
D: Sync,
impl<D> Unpin for Context<D> where
D: Unpin,
[src]
D: Unpin,
impl<D> UnwindSafe for Context<D> where
D: UnwindSafe,
[src]
D: UnwindSafe,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,