Struct rustc_apfloat::ieee::IeeeFloat
source · [−]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
sourceimpl<S: Semantics> IeeeFloat<S>
impl<S: Semantics> IeeeFloat<S>
sourcefn overflow_result(round: Round) -> StatusAnd<Self>
fn overflow_result(round: Round) -> StatusAnd<Self>
Handle positive overflow. We either return infinity or
the largest finite number. For negative overflow,
negate the round
argument before calling.
sourcefn round_away_from_zero(&self, round: Round, loss: Loss, bit: usize) -> bool
fn round_away_from_zero(&self, round: Round, loss: Loss, bit: usize) -> bool
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.
fn normalize(self, round: Round, loss: Loss) -> StatusAnd<Self>
fn from_hexadecimal_string(
s: &str,
round: Round
) -> Result<StatusAnd<Self>, ParseError>
fn from_decimal_string(
s: &str,
round: Round
) -> Result<StatusAnd<Self>, ParseError>
Trait Implementations
sourceimpl<S> AddAssign<IeeeFloat<S>> for IeeeFloat<S>where
Self: Float,
impl<S> AddAssign<IeeeFloat<S>> for IeeeFloat<S>where
Self: Float,
sourcefn add_assign(&mut self, rhs: Self)
fn add_assign(&mut self, rhs: Self)
+=
operation. Read moresourceimpl<S: Semantics> Display for IeeeFloat<S>
impl<S: Semantics> Display for IeeeFloat<S>
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
sourceimpl<S> DivAssign<IeeeFloat<S>> for IeeeFloat<S>where
Self: Float,
impl<S> DivAssign<IeeeFloat<S>> for IeeeFloat<S>where
Self: Float,
sourcefn div_assign(&mut self, rhs: Self)
fn div_assign(&mut self, rhs: Self)
/=
operation. Read moresourceimpl<S: Semantics> Float for IeeeFloat<S>
impl<S: Semantics> Float for IeeeFloat<S>
sourceconst PRECISION: usize = S::PRECISION
const PRECISION: usize = S::PRECISION
sourceconst MAX_EXP: ExpInt = S::MAX_EXP
const MAX_EXP: ExpInt = S::MAX_EXP
sourceconst MIN_EXP: ExpInt = S::MIN_EXP
const MIN_EXP: ExpInt = S::MIN_EXP
sourceconst SMALLEST: Self = _
const SMALLEST: Self = _
sourcefn smallest_normalized() -> Self
fn smallest_normalized() -> Self
fn add_r(self, rhs: Self, round: Round) -> StatusAnd<Self>
fn mul_r(self, rhs: Self, round: Round) -> StatusAnd<Self>
fn mul_add_r(
self,
multiplicand: Self,
addend: Self,
round: Round
) -> StatusAnd<Self>
fn div_r(self, rhs: Self, round: Round) -> StatusAnd<Self>
fn round_to_integral(self, round: Round) -> StatusAnd<Self>
fn from_bits(input: u128) -> Self
fn from_u128_r(input: u128, round: Round) -> StatusAnd<Self>
fn from_str_r(s: &str, round: Round) -> Result<StatusAnd<Self>, ParseError>
fn to_bits(self) -> u128
fn to_u128_r(
self,
width: usize,
round: Round,
is_exact: &mut bool
) -> StatusAnd<u128>
fn cmp_abs_normal(self, rhs: Self) -> Ordering
sourcefn bitwise_eq(self, rhs: Self) -> bool
fn bitwise_eq(self, rhs: Self) -> bool
sourcefn is_negative(self) -> bool
fn is_negative(self) -> bool
sourcefn is_denormal(self) -> bool
fn is_denormal(self) -> bool
sourcefn is_signaling(self) -> bool
fn is_signaling(self) -> bool
true
if the float is a signaling NaN.fn category(self) -> Category
sourcefn get_exact_inverse(self) -> Option<Self>
fn get_exact_inverse(self) -> Option<Self>
sourcefn ilogb(self) -> ExpInt
fn ilogb(self) -> ExpInt
sourcefn scalbn_r(self, exp: ExpInt, round: Round) -> Self
fn scalbn_r(self, exp: ExpInt, round: Round) -> Self
ldexp
. Read moresourcefn frexp_r(self, exp: &mut ExpInt, round: Round) -> Self
fn frexp_r(self, exp: &mut ExpInt, round: Round) -> Self
fn sub_r(self, rhs: Self, round: Round) -> StatusAnd<Self>
fn mul_add(self, multiplicand: Self, addend: Self) -> StatusAnd<Self>
fn abs(self) -> Self
fn copy_sign(self, rhs: Self) -> Self
fn from_i128_r(input: i128, round: Round) -> StatusAnd<Self>
fn from_i128(input: i128) -> StatusAnd<Self>
fn from_u128(input: u128) -> StatusAnd<Self>
sourcefn to_i128_r(
self,
width: usize,
round: Round,
is_exact: &mut bool
) -> StatusAnd<i128>
fn to_i128_r(
self,
width: usize,
round: Round,
is_exact: &mut bool
) -> StatusAnd<i128>
fn to_i128(self, width: usize) -> StatusAnd<i128>
fn to_u128(self, width: usize) -> StatusAnd<u128>
sourcefn min(self, other: Self) -> Self
fn min(self, other: Self) -> Self
sourcefn max(self, other: Self) -> Self
fn max(self, other: Self) -> Self
sourcefn is_normal(self) -> bool
fn is_normal(self) -> bool
sourcefn is_finite(self) -> bool
fn is_finite(self) -> bool
true
if the current value is zero, subnormal, or
normal. Read moresourcefn is_infinite(self) -> bool
fn is_infinite(self) -> bool
fn is_non_zero(self) -> bool
fn is_finite_non_zero(self) -> bool
fn is_pos_zero(self) -> bool
fn is_neg_zero(self) -> bool
sourcefn is_smallest(self) -> bool
fn is_smallest(self) -> bool
true
if the number has the smallest possible non-zero
magnitude in the current semantics. Read moresourcefn is_largest(self) -> bool
fn is_largest(self) -> bool
true
if the number has the largest possible finite
magnitude in the current semantics. Read moresourcefn is_integer(self) -> bool
fn is_integer(self) -> bool
true
if the number is an exact integer.fn scalbn(self, exp: ExpInt) -> Self
fn frexp(self, exp: &mut ExpInt) -> Self
sourceimpl<S: Semantics, T: Semantics> FloatConvert<IeeeFloat<T>> for IeeeFloat<S>
impl<S: Semantics, T: Semantics> FloatConvert<IeeeFloat<T>> for IeeeFloat<S>
sourcefn convert_r(self, round: Round, loses_info: &mut bool) -> StatusAnd<IeeeFloat<T>>
fn convert_r(self, round: Round, loses_info: &mut bool) -> StatusAnd<IeeeFloat<T>>
value == Status::OK
,
but there are edge cases where this is not so). Read morefn convert(self, loses_info: &mut bool) -> StatusAnd<T>
sourceimpl<F: FloatConvert<Self>> From<DoubleFloat<F>> for IeeeFloat<FallbackS<F>>
impl<F: FloatConvert<Self>> From<DoubleFloat<F>> for IeeeFloat<FallbackS<F>>
sourcefn from(DoubleFloat: DoubleFloat<F>) -> Self
fn from(DoubleFloat: DoubleFloat<F>) -> Self
sourceimpl<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>,
sourceimpl<S> FromStr for IeeeFloat<S>where
Self: Float,
impl<S> FromStr for IeeeFloat<S>where
Self: Float,
type Err = ParseError
type Err = ParseError
sourceimpl<S> MulAssign<IeeeFloat<S>> for IeeeFloat<S>where
Self: Float,
impl<S> MulAssign<IeeeFloat<S>> for IeeeFloat<S>where
Self: Float,
sourcefn mul_assign(&mut self, rhs: Self)
fn mul_assign(&mut self, rhs: Self)
*=
operation. Read moresourceimpl<S: Semantics> PartialEq<IeeeFloat<S>> for IeeeFloat<S>
impl<S: Semantics> PartialEq<IeeeFloat<S>> for IeeeFloat<S>
sourceimpl<S: Semantics> PartialOrd<IeeeFloat<S>> for IeeeFloat<S>
impl<S: Semantics> PartialOrd<IeeeFloat<S>> for IeeeFloat<S>
sourcefn partial_cmp(&self, rhs: &Self) -> Option<Ordering>
fn partial_cmp(&self, rhs: &Self) -> Option<Ordering>
1.0.0 · sourcefn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
self
and other
) and is used by the <=
operator. Read moresourceimpl<S> RemAssign<IeeeFloat<S>> for IeeeFloat<S>where
Self: Float,
impl<S> RemAssign<IeeeFloat<S>> for IeeeFloat<S>where
Self: Float,
sourcefn rem_assign(&mut self, rhs: Self)
fn rem_assign(&mut self, rhs: Self)
%=
operation. Read moresourceimpl<S> SubAssign<IeeeFloat<S>> for IeeeFloat<S>where
Self: Float,
impl<S> SubAssign<IeeeFloat<S>> for IeeeFloat<S>where
Self: Float,
sourcefn sub_assign(&mut self, rhs: Self)
fn sub_assign(&mut self, rhs: Self)
-=
operation. Read moreimpl<S> Copy for IeeeFloat<S>
Auto Trait Implementations
impl<S> RefUnwindSafe for IeeeFloat<S>where
S: RefUnwindSafe,
impl<S> Send for IeeeFloat<S>where
S: Send,
impl<S> Sync for IeeeFloat<S>where
S: Sync,
impl<S> Unpin for IeeeFloat<S>where
S: Unpin,
impl<S> UnwindSafe for IeeeFloat<S>where
S: UnwindSafe,
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
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