Enum fixed_decimal::FloatPrecision
source · #[non_exhaustive]pub enum FloatPrecision {
Integer,
Magnitude(i16),
SignificantDigits(u8),
Floating,
}
Expand description
Specifies the precision of a floating point value when constructing a FixedDecimal.
IEEE 754 is a representation of a point on the number line. On the other hand, FixedDecimal specifies not only the point on the number line but also the precision of the number to a specific power of 10. This enum augments a floating-point value with the additional information required by FixedDecimal.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Integer
Specify that the floating point number is integer-valued.
If the floating point is not actually integer-valued, an error will be returned.
Magnitude(i16)
Specify that the floating point number is precise to a specific power of 10. The number may be rounded or trailing zeros may be added as necessary.
SignificantDigits(u8)
Specify that the floating point number is precise to a specific number of significant digits. The number may be rounded or trailing zeros may be added as necessary.
The number requested may not be zero
Floating
Specify that the floating point number is precise to the maximum representable by IEEE.
This results in a FixedDecimal having enough digits to recover the original floating point value, with no trailing zeros.
Trait Implementations§
source§impl Clone for FloatPrecision
impl Clone for FloatPrecision
source§fn clone(&self) -> FloatPrecision
fn clone(&self) -> FloatPrecision
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl Debug for FloatPrecision
impl Debug for FloatPrecision
impl Copy for FloatPrecision
Auto Trait Implementations§
impl Freeze for FloatPrecision
impl RefUnwindSafe for FloatPrecision
impl Send for FloatPrecision
impl Sync for FloatPrecision
impl Unpin for FloatPrecision
impl UnwindSafe for FloatPrecision
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
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)