#[repr(transparent)]pub struct Decimal64 { /* private fields */ }
Expand description
A 64-bit decimal floating-point number.
Additional operations are defined as methods on the Context
type.
For convenience, Decimal64
overloads many of the standard Rust operators.
For example, you can use the standard +
operator to add two values
together:
use dec::Decimal64;
let a = Decimal64::from(1);
let b = Decimal64::from(2);
assert_eq!(a + b, Decimal64::from(3));
These overloaded operators implicitly construct a single-use default context, which has some performance overhead. For maximum performance when performing operations in bulk, use a long-lived context that you construct yourself.
Implementations
Creates a number from its representation as a little-endian byte array.
Creates a number from its representation as a big-endian byte array.
Creates a number from its representation as a byte array in the native endianness of the target platform.
Returns the memory representation of the number as a byte array in little-endian order.
Returns the memory representation of the number as a byte array in big-endian order.
Returns the memory representation of the number as a byte array in the native endianness of the target platform.
Computes the number of significant digits in the number.
If the number is zero or infinite, returns 1. If the number is a NaN, returns the number of digits in the payload.
Computes the coefficient of the number.
If the number is a special value (i.e., NaN or infinity), returns zero.
Returns the individual digits of the coefficient in 8-bit, unpacked binary-coded decimal format.
Returns an equivalent number whose encoding is guaranteed to be canonical.
Reports whether the encoding of the number is canonical.
Reports whether the number is finite.
A finite number is one that is neither infinite nor a NaN.
Reports whether the number is positive or negative infinity.
Reports whether the number is an integer.
An integer is a decimal number that is finite and has an exponent of zero.
Reports whether the number is a valid argument for logical operations.
A number is a valid argument for logical operations if it is a nonnegative integer where each digit is either zero or one.
Reports whether the number is less than zero and not a NaN.
Reports whether the number is normal.
A normal number is finite, non-zero, and not subnormal.
Reports whether the number is greater than zero and not a NaN.
Reports whether the number is a signaling NaN.
Reports whether the number has a sign of 1.
Note that zeros and NaNs may have a sign of 1.
Reports whether the number is subnormal.
A subnormal number is finite, non-zero, and has magnitude less than 10emin.
Reports whether the quantum of the number matches the quantum of
rhs
.
Quantums are considered to match if the numbers have the same exponent, are both NaNs, or both infinite.
Determines the ordering of this number relative to rhs
, using the
total order predicate defined in IEEE 754-2008.
For a brief description of the ordering, consult f32::total_cmp
.
Returns a string of the number in standard notation, i.e. guaranteed to not be scientific notation.
Trait Implementations
Performs the +=
operation. Read more
Performs the /=
operation. Read more
Performs the conversion.
Performs the conversion.
type Err = ParseDecimalError
type Err = ParseDecimalError
The associated error which can be returned from parsing.
Performs the *=
operation. Read more
This method returns an ordering between self
and other
values if one exists. Read more
This method tests less than (for self
and other
) and is used by the <
operator. Read more
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
This method tests greater than (for self
and other
) and is used by the >
operator. Read more
Performs the %=
operation. Read more
Performs the -=
operation. Read more
Auto Trait Implementations
impl RefUnwindSafe for Decimal64
impl UnwindSafe for Decimal64
Blanket Implementations
Mutably borrows from an owned value. Read more