pub struct IeeeFloat<S> { /* private fields */ }

Trait Implementations§

source§

impl<S> Add<IeeeFloat<S>> for IeeeFloat<S>where Self: Float,

§

type Output = StatusAnd<IeeeFloat<S>>

The resulting type after applying the + operator.
source§

fn add(self, rhs: Self) -> StatusAnd<Self>

Performs the + operation. Read more
source§

impl<S> AddAssign<IeeeFloat<S>> for IeeeFloat<S>where Self: Float,

source§

fn add_assign(&mut self, rhs: Self)

Performs the += operation. Read more
source§

impl<S> Clone for IeeeFloat<S>

source§

fn clone(&self) -> Self

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<S: Semantics> Debug for IeeeFloat<S>

source§

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

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

impl<S> Default for IeeeFloat<S>where Self: Float,

source§

fn default() -> Self

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

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

source§

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

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

impl<S> Div<IeeeFloat<S>> for IeeeFloat<S>where Self: Float,

§

type Output = StatusAnd<IeeeFloat<S>>

The resulting type after applying the / operator.
source§

fn div(self, rhs: Self) -> StatusAnd<Self>

Performs the / operation. Read more
source§

impl<S> DivAssign<IeeeFloat<S>> for IeeeFloat<S>where Self: Float,

source§

fn div_assign(&mut self, rhs: Self)

Performs the /= operation. Read more
source§

impl<S: Semantics> Float for IeeeFloat<S>

source§

const BITS: usize = S::BITS

Total number of bits in the in-memory format.
source§

const PRECISION: usize = S::PRECISION

Number of bits in the significand. This includes the integer bit.
source§

const MAX_EXP: ExpInt = S::MAX_EXP

The largest E such that 2^E is representable; this matches the definition of IEEE 754.
source§

const MIN_EXP: ExpInt = S::MIN_EXP

The smallest E such that 2^E is a normalized number; this matches the definition of IEEE 754.
source§

const ZERO: Self = _

Positive Zero.
source§

const INFINITY: Self = _

Positive Infinity.
source§

const NAN: Self = _

NaN (Not a Number).
source§

fn qnan(payload: Option<u128>) -> Self

Factory for QNaN values.
source§

fn snan(payload: Option<u128>) -> Self

Factory for SNaN values.
source§

fn largest() -> Self

Largest finite number.
source§

const SMALLEST: Self = _

Smallest (by magnitude) finite number. Might be denormalized, which implies a relative loss of precision.
source§

fn smallest_normalized() -> Self

Smallest (by magnitude) normalized finite number.
source§

fn add_r(self, rhs: Self, round: Round) -> StatusAnd<Self>

source§

fn sub_r(self, rhs: Self, round: Round) -> StatusAnd<Self>

source§

fn mul_r(self, rhs: Self, round: Round) -> StatusAnd<Self>

source§

fn mul_add_r( self, multiplicand: Self, addend: Self, round: Round ) -> StatusAnd<Self>

source§

fn div_r(self, rhs: Self, round: Round) -> StatusAnd<Self>

source§

fn ieee_rem(self, rhs: Self) -> StatusAnd<Self>

IEEE remainder.
source§

fn c_fmod(self, rhs: Self) -> StatusAnd<Self>

C fmod, or llvm frem.
source§

fn round_to_integral(self, round: Round) -> StatusAnd<Self>

source§

fn next_up(self) -> StatusAnd<Self>

IEEE-754R 2008 5.3.1: nextUp.
source§

fn from_bits(input: u128) -> Self

source§

fn from_u128_r(input: u128, round: Round) -> StatusAnd<Self>

source§

fn from_str_r(s: &str, round: Round) -> Result<StatusAnd<Self>, ParseError>

source§

fn to_bits(self) -> u128

source§

fn to_u128_r( self, width: usize, round: Round, is_exact: &mut bool ) -> StatusAnd<u128>

source§

fn cmp_abs_normal(self, rhs: Self) -> Ordering

source§

fn bitwise_eq(self, rhs: Self) -> bool

Bitwise comparison for equality (QNaNs compare equal, 0!=-0).
source§

fn is_negative(self) -> bool

IEEE-754R isSignMinus: Returns true if and only if the current value is negative. Read more
source§

fn is_denormal(self) -> bool

IEEE-754R isSubnormal(): Returns true if and only if the float is a denormal.
source§

fn is_signaling(self) -> bool

Returns true if and only if the float is a signaling NaN.
source§

fn category(self) -> Category

source§

fn get_exact_inverse(self) -> Option<Self>

If this value has an exact multiplicative inverse, return it.
source§

fn ilogb(self) -> ExpInt

Returns the exponent of the internal representation of the Float. Read more
source§

fn scalbn_r(self, exp: ExpInt, round: Round) -> Self

Returns: self * 2^exp for integral exponents.
source§

fn frexp_r(self, exp: &mut ExpInt, round: Round) -> Self

Equivalent of C standard library function. Read more
source§

fn mul_add(self, multiplicand: Self, addend: Self) -> StatusAnd<Self>

source§

fn next_down(self) -> StatusAnd<Self>

IEEE-754R 2008 5.3.1: nextDown. Read more
source§

fn abs(self) -> Self

source§

fn copy_sign(self, rhs: Self) -> Self

source§

fn from_i128_r(input: i128, round: Round) -> StatusAnd<Self>

source§

fn from_i128(input: i128) -> StatusAnd<Self>

source§

fn from_u128(input: u128) -> StatusAnd<Self>

source§

fn to_i128_r( self, width: usize, round: Round, is_exact: &mut bool ) -> StatusAnd<i128>

Convert 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
source§

fn to_i128(self, width: usize) -> StatusAnd<i128>

source§

fn to_u128(self, width: usize) -> StatusAnd<u128>

source§

fn min(self, other: Self) -> Self

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.
source§

fn max(self, other: Self) -> Self

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.
source§

fn minimum(self, other: Self) -> Self

Implements IEEE 754-2018 minimum semantics. Returns the smaller of 2 arguments, propagating NaNs and treating -0 as less than +0.
source§

fn maximum(self, other: Self) -> Self

Implements IEEE 754-2018 maximum semantics. Returns the larger of 2 arguments, propagating NaNs and treating -0 as less than +0.
source§

fn is_normal(self) -> bool

IEEE-754R isNormal: Returns true if and only if the current value is normal. Read more
source§

fn is_finite(self) -> bool

Returns true if and only if the current value is zero, subnormal, or normal. Read more
source§

fn is_zero(self) -> bool

Returns true if and only if the float is plus or minus zero.
source§

fn is_infinite(self) -> bool

IEEE-754R isInfinite(): Returns true if and only if the float is infinity.
source§

fn is_nan(self) -> bool

Returns true if and only if the float is a quiet or signaling NaN.
source§

fn is_non_zero(self) -> bool

source§

fn is_finite_non_zero(self) -> bool

source§

fn is_pos_zero(self) -> bool

source§

fn is_neg_zero(self) -> bool

source§

fn is_pos_infinity(self) -> bool

source§

fn is_neg_infinity(self) -> bool

source§

fn is_smallest(self) -> bool

Returns true if and only if the number has the smallest possible non-zero magnitude in the current semantics.
source§

fn is_smallest_normalized(self) -> bool

Returns true if this is the smallest (by magnitude) normalized finite number in the given semantics.
source§

fn is_largest(self) -> bool

Returns true if and only if the number has the largest possible finite magnitude in the current semantics.
source§

fn is_integer(self) -> bool

Returns true if and only if the number is an exact integer.
source§

fn scalbn(self, exp: ExpInt) -> Self

source§

fn frexp(self, exp: &mut ExpInt) -> Self

source§

impl<S: Semantics, T: Semantics> FloatConvert<IeeeFloat<T>> for IeeeFloat<S>

source§

fn convert_r( self, round: Round, loses_info: &mut bool ) -> StatusAnd<IeeeFloat<T>>

Convert 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).
source§

fn convert(self, loses_info: &mut bool) -> StatusAnd<T>

source§

impl<F: FloatConvert<Self>> From<DoubleFloat<F>> for IeeeFloat<FallbackS<F>>

source§

fn from(DoubleFloat: DoubleFloat<F>) -> Self

Converts to this type from the input type.
source§

impl<F> From<IeeeFloat<FallbackS<F>>> for DoubleFloat<F>where F: FloatConvert<IeeeFloat<FallbackExtendedS<F>>> + Float, IeeeFloat<FallbackExtendedS<F>>: FloatConvert<F>,

source§

fn from(x: IeeeFloat<FallbackS<F>>) -> Self

Converts to this type from the input type.
source§

impl<S> FromStr for IeeeFloat<S>where Self: Float,

§

type Err = ParseError

The associated error which can be returned from parsing.
source§

fn from_str(s: &str) -> Result<Self, ParseError>

Parses a string s to return a value of this type. Read more
source§

impl<S> Mul<IeeeFloat<S>> for IeeeFloat<S>where Self: Float,

§

type Output = StatusAnd<IeeeFloat<S>>

The resulting type after applying the * operator.
source§

fn mul(self, rhs: Self) -> StatusAnd<Self>

Performs the * operation. Read more
source§

impl<S> MulAssign<IeeeFloat<S>> for IeeeFloat<S>where Self: Float,

source§

fn mul_assign(&mut self, rhs: Self)

Performs the *= operation. Read more
source§

impl<S: Semantics> Neg for IeeeFloat<S>

§

type Output = IeeeFloat<S>

The resulting type after applying the - operator.
source§

fn neg(self) -> Self

Performs the unary - operation. Read more
source§

impl<S: Semantics> PartialEq<IeeeFloat<S>> for IeeeFloat<S>

source§

fn eq(&self, rhs: &Self) -> 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<S: Semantics> PartialOrd<IeeeFloat<S>> for IeeeFloat<S>

source§

fn partial_cmp(&self, rhs: &Self) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · source§

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

This method tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · source§

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

This method tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · source§

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

This method tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · source§

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

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more
source§

impl<S> Rem<IeeeFloat<S>> for IeeeFloat<S>where Self: Float,

§

type Output = StatusAnd<IeeeFloat<S>>

The resulting type after applying the % operator.
source§

fn rem(self, rhs: Self) -> StatusAnd<Self>

Performs the % operation. Read more
source§

impl<S> RemAssign<IeeeFloat<S>> for IeeeFloat<S>where Self: Float,

source§

fn rem_assign(&mut self, rhs: Self)

Performs the %= operation. Read more
source§

impl<S> Sub<IeeeFloat<S>> for IeeeFloat<S>where Self: Float,

§

type Output = StatusAnd<IeeeFloat<S>>

The resulting type after applying the - operator.
source§

fn sub(self, rhs: Self) -> StatusAnd<Self>

Performs the - operation. Read more
source§

impl<S> SubAssign<IeeeFloat<S>> for IeeeFloat<S>where Self: Float,

source§

fn sub_assign(&mut self, rhs: Self)

Performs the -= operation. Read more
source§

impl<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§

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> ToOwned for Twhere T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T> ToString for Twhere T: Display + ?Sized,

source§

default fn to_string(&self) -> String

Converts the given value to a String. Read more
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.