pub struct Number {
pub exponent: i64,
pub mantissa: u64,
pub negative: bool,
pub many_digits: bool,
}
🔬This is a nightly-only experimental API. (
dec2flt
)Fields§
§exponent: i64
🔬This is a nightly-only experimental API. (
§dec2flt
)mantissa: u64
🔬This is a nightly-only experimental API. (
§dec2flt
)negative: bool
🔬This is a nightly-only experimental API. (
§dec2flt
)many_digits: bool
🔬This is a nightly-only experimental API. (
dec2flt
)Implementations§
source§impl Number
impl Number
sourcefn is_fast_path<F: RawFloat>(&self) -> bool
🔬This is a nightly-only experimental API. (dec2flt
)
fn is_fast_path<F: RawFloat>(&self) -> bool
dec2flt
)Detect if the float can be accurately reconstructed from native floats.
sourcepub fn try_fast_path<F: RawFloat>(&self) -> Option<F>
🔬This is a nightly-only experimental API. (dec2flt
)
pub fn try_fast_path<F: RawFloat>(&self) -> Option<F>
dec2flt
)The fast path algorithm using machine-sized integers and floats.
This is extracted into a separate function so that it can be attempted before constructing a Decimal. This only works if both the mantissa and the exponent can be exactly represented as a machine float, since IEE-754 guarantees no rounding will occur.
There is an exception: disguised fast-path cases, where we can shift powers-of-10 from the exponent to the significant digits.
Trait Implementations§
source§impl PartialEq<Number> for Number
impl PartialEq<Number> for Number
impl Copy for Number
impl StructuralEq for Number
impl StructuralPartialEq for Number
Auto Trait Implementations§
impl Freeze for Number
impl RefUnwindSafe for Number
impl Send for Number
impl Sync for Number
impl Unpin for Number
impl UnwindSafe for Number
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