pub struct IeeeFloat<S> {
    sig: [u128; 1],
    exp: ExpInt,
    category: Category,
    sign: bool,
    marker: PhantomData<S>,
}

Fields

sig: [u128; 1]

Absolute significand value (including the integer bit).

exp: ExpInt

The signed unbiased exponent of the value.

category: Category

What kind of floating point number this is.

sign: bool

Sign bit of the number.

marker: PhantomData<S>

Implementations

Handle positive overflow. We either return infinity or the largest finite number. For negative overflow, negate the round argument before calling.

Returns true if, when truncating the current number, with bit the new LSB, with the given lost fraction and rounding mode, the result would need to be rounded away from zero (i.e., by increasing the signficand). This routine must work for Category::Zero of both signs, and Category::Normal numbers.

Trait Implementations

The resulting type after applying the + operator.
Performs the + operation. Read more
Performs the += operation. Read more
Returns a copy of the value. Read more
Performs copy-assignment from source. Read more
Formats the value using the given formatter. Read more
Returns the “default value” for a type. Read more

Prints this value as a decimal string.

\param precision The maximum number of digits of precision to output. If there are fewer digits available, zero padding will not be used unless the value is integral and small enough to be expressed in precision digits. 0 means to use the natural precision of the number. \param width The maximum number of zeros to consider inserting before falling back to scientific notation. 0 means to always use scientific notation.

\param alternate Indicate whether to remove the trailing zero in fraction part or not. Also setting this parameter to true forces producing of output more similar to default printf behavior. Specifically the lower e is used as exponent delimiter and exponent always contains no less than two digits.

Number precision width Result


1.01E+4 5 2 10100 1.01E+4 4 2 1.01E+4 1.01E+4 5 1 1.01E+4 1.01E-2 5 2 0.0101 1.01E-2 4 2 0.0101 1.01E-2 4 1 1.01E-2

Formats the value using the given formatter. Read more
The resulting type after applying the / operator.
Performs the / operation. Read more
Performs the /= operation. Read more
Total number of bits in the in-memory format.
Number of bits in the significand. This includes the integer bit.
The largest E such that 2E is representable; this matches the definition of IEEE 754. Read more
The smallest E such that 2E is a normalized number; this matches the definition of IEEE 754. Read more
Positive Zero.
Positive Infinity.
NaN (Not a Number).
Factory for QNaN values.
Factory for SNaN values.
Largest finite number.
Smallest (by magnitude) finite number. Might be denormalized, which implies a relative loss of precision. Read more
Smallest (by magnitude) normalized finite number.
C fmod, or llvm frem.
IEEE-754R 2008 5.3.1: nextUp.
Bitwise comparison for equality (QNaNs compare equal, 0!=-0).
IEEE-754R isSignMinus: Returns whether the current value is negative. Read more
IEEE-754R isSubnormal(): Returns whether the float is a denormal. Read more
Returns true if the float is a signaling NaN.
If this value has an exact multiplicative inverse, return it.
Returns the exponent of the internal representation of the Float. Read more
Returns: self * 2exp for integral exponents. Equivalent to C standard library function ldexp. Read more
Equivalent to C standard library function with the same name. Read more
IEEE remainder.
IEEE-754R 2008 5.3.1: nextDown. Read more
Converts a floating point number to an integer according to the rounding mode. In case of an invalid operation exception, deterministic values are returned, namely zero for NaNs and the minimal or maximal value respectively for underflow or overflow. If the rounded value is in range but the floating point number is not the exact integer, the C standard doesn’t require an inexact exception to be raised. IEEE-854 does require it so we do that. Read more
Implements IEEE minNum semantics. Returns the smaller of the 2 arguments if both are not NaN. If either argument is a NaN, returns the other argument. Read more
Implements IEEE maxNum semantics. Returns the larger of the 2 arguments if both are not NaN. If either argument is a NaN, returns the other argument. Read more
IEEE-754R isNormal: Returns whether the current value is normal. Read more
Returns true if the current value is zero, subnormal, or normal. Read more
Returns true if the float is plus or minus zero.
IEEE-754R isInfinite(): Returns whether the float is infinity.
Returns true if the float is a quiet or signaling NaN.
Returns true if the number has the smallest possible non-zero magnitude in the current semantics. Read more
Returns true if the number has the largest possible finite magnitude in the current semantics. Read more
Returns true if the number is an exact integer.
Converts a value of one floating point type to another. The return value corresponds to the IEEE754 exceptions. *loses_info records whether the transformation lost information, i.e., whether converting the result back to the original type will produce the original value (this is almost the same as return value == Status::OK, but there are edge cases where this is not so). Read more
Converts to this type from the input type.
Converts to this type from the input type.
The associated error which can be returned from parsing.
Parses a string s to return a value of this type. Read more
The resulting type after applying the * operator.
Performs the * operation. Read more
Performs the *= operation. Read more
The resulting type after applying the - operator.
Performs the unary - operation. Read more
This method tests for self and other values to be equal, and is used by ==. Read more
This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason. 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
This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more
The resulting type after applying the % operator.
Performs the % operation. Read more
Performs the %= operation. Read more
The resulting type after applying the - operator.
Performs the - operation. Read more
Performs the -= operation. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

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

The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
Uses borrowed data to replace owned data, usually by cloning. Read more
Converts the given value to a String. Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.

Layout

Note: Most layout information is completely unstable and may even differ between compilations. The only exception is types with certain repr(...) attributes. Please see the Rust Reference’s “Type Layout” chapter for details on type layout guarantees.

Size: 24 bytes