Struct rustc_apfloat::ieee::IeeeFloat [−][src]
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
Performs the +=
operation. 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
Performs the /=
operation. Read more
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
Smallest (by magnitude) finite number. Might be denormalized, which implies a relative loss of precision. Read more
Smallest (by magnitude) normalized finite number.
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
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
IEEE-754R isInfinite(): Returns whether the float is infinity.
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
Performs the conversion.
impl<F: Float> From<IeeeFloat<FallbackS<F>>> for DoubleFloat<F> where
F: FloatConvert<IeeeFloat<FallbackExtendedS<F>>>,
IeeeFloat<FallbackExtendedS<F>>: FloatConvert<F>,
impl<F: Float> From<IeeeFloat<FallbackS<F>>> for DoubleFloat<F> where
F: FloatConvert<IeeeFloat<FallbackExtendedS<F>>>,
IeeeFloat<FallbackExtendedS<F>>: FloatConvert<F>,
type Err = ParseError
type Err = ParseError
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<S> RefUnwindSafe for IeeeFloat<S> where
S: RefUnwindSafe,
impl<S> UnwindSafe for IeeeFloat<S> where
S: UnwindSafe,
Blanket Implementations
Mutably borrows from an owned value. Read more
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