Struct core::num::dec2flt::number::Number

source ·
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

source

fn is_fast_path<F: RawFloat>(&self) -> bool

🔬This is a nightly-only experimental API. (dec2flt)

Detect if the float can be accurately reconstructed from native floats.

source

pub fn try_fast_path<F: RawFloat>(&self) -> Option<F>

🔬This is a nightly-only experimental API. (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 Clone for Number

source§

fn clone(&self) -> Number

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for Number

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Default for Number

source§

fn default() -> Number

Returns the “default value” for a type. Read more
source§

impl Eq for Number

source§

impl PartialEq<Number> for Number

source§

fn eq(&self, other: &Number) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl Copy for Number

source§

impl StructuralEq for Number

source§

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> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> SizedTypeProperties for T

source§

const IS_ZST: bool = _

🔬This is a nightly-only experimental API. (sized_type_properties)
true if this type requires no storage. false if its size is greater than zero. Read more
source§

impl<T> SpecOptionPartialEq for Twhere T: PartialEq<T>,

source§

default fn eq(l: &Option<T>, r: &Option<T>) -> bool

🔬This is a nightly-only experimental API. (spec_option_partial_eq)
source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
source§

impl<T> Printable for Twhere T: Copy + Debug,