[][src]Struct simple_soft_float::Float

pub struct Float<FT: FloatTraits> { /* fields omitted */ }

the floating-point type with the specified FloatTraits

Methods

impl<Bits: FloatBitsType, FT: FloatTraits<Bits = Bits>> Float<FT>[src]

pub fn from_bits_and_traits(bits: Bits, traits: FT) -> Self[src]

construct Float from bits

pub fn from_bits(bits: Bits) -> Self where
    FT: Default
[src]

construct Float from bits

pub fn bits(&self) -> &Bits[src]

get the underlying bits

pub fn set_bits(&mut self, bits: Bits)[src]

set the underlying bits

pub fn traits(&self) -> &FT[src]

get the FloatTraits

pub fn into_bits_and_traits(self) -> (Bits, FT)[src]

get the bits and FloatTraits

pub fn into_bits(self) -> Bits[src]

get the underlying bits

pub fn into_traits(self) -> FT[src]

get the FloatTraits

pub fn properties(&self) -> FloatProperties[src]

get the FloatProperties

pub fn sign(&self) -> Sign[src]

get the sign

pub fn set_sign(&mut self, sign: Sign)[src]

set the sign

pub fn toggle_sign(&mut self)[src]

toggle the sign

pub fn exponent_field(&self) -> Bits[src]

get the exponent field

the mathematical exponent and the exponent field's values for normal floating-point numbers are related by the following equation: mathematical_exponent + exponent_bias == exponent_field

pub fn set_exponent_field(&mut self, exponent: Bits)[src]

set the exponent field

the mathematical exponent and the exponent field's values for normal floating-point numbers are related by the following equation: mathematical_exponent + exponent_bias == exponent_field

pub fn mantissa_field(&self) -> Bits[src]

get the mantissa field

pub fn set_mantissa_field(&mut self, mantissa: Bits)[src]

set the mantissa field

pub fn mantissa_field_msb(&self) -> bool[src]

get the mantissa field's MSB

pub fn set_mantissa_field_msb(&mut self, mantissa_msb: bool)[src]

set the mantissa field's MSB

pub fn class(&self) -> FloatClass[src]

calculate the FloatClass

pub fn is_negative_infinity(&self) -> bool[src]

return true if self.class() is NegativeInfinity

pub fn is_negative_normal(&self) -> bool[src]

return true if self.class() is NegativeNormal

pub fn is_negative_subnormal(&self) -> bool[src]

return true if self.class() is NegativeSubnormal

pub fn is_negative_zero(&self) -> bool[src]

return true if self.class() is NegativeZero

pub fn is_positive_infinity(&self) -> bool[src]

return true if self.class() is PositiveInfinity

pub fn is_positive_normal(&self) -> bool[src]

return true if self.class() is PositiveNormal

pub fn is_positive_subnormal(&self) -> bool[src]

return true if self.class() is PositiveSubnormal

pub fn is_positive_zero(&self) -> bool[src]

return true if self.class() is PositiveZero

pub fn is_quiet_nan(&self) -> bool[src]

return true if self.class() is QuietNaN

pub fn is_signaling_nan(&self) -> bool[src]

return true if self.class() is SignalingNaN

pub fn is_infinity(&self) -> bool[src]

return true if self is infinity

pub fn is_normal(&self) -> bool[src]

return true if self.class() is NegativeNormal or PositiveNormal

pub fn is_subnormal(&self) -> bool[src]

return true if self is subnormal

pub fn is_zero(&self) -> bool[src]

return true if self is zero

pub fn is_nan(&self) -> bool[src]

return true if self is NaN

pub fn is_finite(&self) -> bool[src]

return true if self is finite (not NaN or infinity)

pub fn is_subnormal_or_zero(&self) -> bool[src]

return true if self is subnormal or zero

pub fn to_ratio(&self) -> Option<Ratio<BigInt>>[src]

get the mathematical value of self as a Ratio<BigInt>. if self is NaN or infinite, returns None.

pub fn to_real_algebraic_number(&self) -> Option<RealAlgebraicNumber>[src]

get the mathematical value of self as a RealAlgebraicNumber. if self is NaN or infinite, returns None.

pub fn positive_zero_with_traits(traits: FT) -> Self[src]

get the positive zero value

pub fn positive_zero() -> Self where
    FT: Default
[src]

get the positive zero value

pub fn negative_zero_with_traits(traits: FT) -> Self[src]

get the negative zero value

pub fn negative_zero() -> Self where
    FT: Default
[src]

get the negative zero value

pub fn signed_zero_with_traits(sign: Sign, traits: FT) -> Self[src]

get the zero with sign sign

pub fn signed_zero(sign: Sign) -> Self where
    FT: Default
[src]

get the zero with sign sign

pub fn positive_infinity_with_traits(traits: FT) -> Self[src]

get the positive infinity value

pub fn positive_infinity() -> Self where
    FT: Default
[src]

get the positive infinity value

pub fn negative_infinity_with_traits(traits: FT) -> Self[src]

get the negative infinity value

pub fn negative_infinity() -> Self where
    FT: Default
[src]

get the negative infinity value

pub fn signed_infinity_with_traits(sign: Sign, traits: FT) -> Self[src]

get the infinity with sign sign

pub fn signed_infinity(sign: Sign) -> Self where
    FT: Default
[src]

get the infinity with sign sign

pub fn quiet_nan_with_traits(traits: FT) -> Self[src]

get the canonical quiet NaN, which is also just the canonical NaN

pub fn quiet_nan() -> Self where
    FT: Default
[src]

get the canonical quiet NaN, which is also just the canonical NaN

pub fn signaling_nan_with_traits(traits: FT) -> Self[src]

get the canonical signaling NaN

pub fn signaling_nan() -> Self where
    FT: Default
[src]

get the canonical signaling NaN

pub fn into_quiet_nan(self) -> Self[src]

convert self into a quiet NaN

pub fn to_quiet_nan(&self) -> Self[src]

convert self into a quiet NaN

pub fn signed_max_normal_with_traits(sign: Sign, traits: FT) -> Self[src]

get the largest finite value with sign sign

pub fn signed_max_normal(sign: Sign) -> Self where
    FT: Default
[src]

get the largest finite value with sign sign

pub fn signed_min_subnormal_with_traits(sign: Sign, traits: FT) -> Self[src]

get the subnormal value closest to zero with sign sign

pub fn signed_min_subnormal(sign: Sign) -> Self where
    FT: Default
[src]

get the subnormal value closest to zero with sign sign

pub fn from_real_algebraic_number_with_traits(
    value: &RealAlgebraicNumber,
    rounding_mode: Option<RoundingMode>,
    fp_state: Option<&mut FPState>,
    traits: FT
) -> Self
[src]

round from a RealAlgebraicNumber into a floating-point value.

pub fn from_real_algebraic_number(
    value: &RealAlgebraicNumber,
    rounding_mode: Option<RoundingMode>,
    fp_state: Option<&mut FPState>
) -> Self where
    FT: Default
[src]

round from a RealAlgebraicNumber into a floating-point value.

pub fn add(
    &self,
    rhs: &Self,
    rounding_mode: Option<RoundingMode>,
    fp_state: Option<&mut FPState>
) -> Self
[src]

add floating-point numbers

pub fn sub(
    &self,
    rhs: &Self,
    rounding_mode: Option<RoundingMode>,
    fp_state: Option<&mut FPState>
) -> Self
[src]

subtract floating-point numbers

pub fn mul(
    &self,
    rhs: &Self,
    rounding_mode: Option<RoundingMode>,
    fp_state: Option<&mut FPState>
) -> Self
[src]

multiply floating-point numbers

pub fn div(
    &self,
    rhs: &Self,
    rounding_mode: Option<RoundingMode>,
    fp_state: Option<&mut FPState>
) -> Self
[src]

divide floating-point numbers

pub fn ieee754_remainder(
    &self,
    rhs: &Self,
    rounding_mode: Option<RoundingMode>,
    fp_state: Option<&mut FPState>
) -> Self
[src]

compute the IEEE 754 remainder of two floating-point numbers

pub fn fused_mul_add(
    &self,
    factor: &Self,
    term: &Self,
    rounding_mode: Option<RoundingMode>,
    fp_state: Option<&mut FPState>
) -> Self
[src]

calculate the result of (self * factor) + term rounding only once, returning the result

pub fn round_to_integer(
    &self,
    exact: bool,
    rounding_mode: Option<RoundingMode>,
    fp_state: Option<&mut FPState>
) -> Option<BigInt>
[src]

round self to an integer, returning the result as an integer or None

pub fn round_to_integral(
    &self,
    exact: bool,
    rounding_mode: Option<RoundingMode>,
    fp_state: Option<&mut FPState>
) -> Self
[src]

round self to an integer, returning the result as a Float

pub fn normalize(&mut self)[src]

normalize self. This is a no-op for all floating-point formats where has_implicit_leading_bit is true (which includes all standard floating-point formats).

pub fn next_up_or_down(
    &self,
    up_or_down: UpOrDown,
    fp_state: Option<&mut FPState>
) -> Self
[src]

compute the result of next_up or next_down

pub fn next_up(&self, fp_state: Option<&mut FPState>) -> Self[src]

compute the least floating-point number that compares greater than self

pub fn next_down(&self, fp_state: Option<&mut FPState>) -> Self[src]

compute the greatest floating-point number that compares less than self

pub fn log_b(&self, fp_state: Option<&mut FPState>) -> Option<BigInt>[src]

get the floor of the log base 2 of the absolute value of self

pub fn scale_b(
    &self,
    scale: BigInt,
    rounding_mode: Option<RoundingMode>,
    fp_state: Option<&mut FPState>
) -> Self
[src]

get self * 2^scale

pub fn sqrt(
    &self,
    rounding_mode: Option<RoundingMode>,
    fp_state: Option<&mut FPState>
) -> Self
[src]

get the square-root of self

pub fn convert_from_float_with_traits<SrcFT: FloatTraits>(
    src: &Float<SrcFT>,
    rounding_mode: Option<RoundingMode>,
    fp_state: Option<&mut FPState>,
    traits: FT
) -> Self
[src]

convert src to the floating-point format specified by traits.

pub fn convert_from_float<SrcFT: FloatTraits>(
    src: &Float<SrcFT>,
    rounding_mode: Option<RoundingMode>,
    fp_state: Option<&mut FPState>
) -> Self where
    FT: Default
[src]

convert src to the floating-point format specified by FT::default() where Self is Float<FT>.

pub fn convert_to_float_with_traits<DestFT: FloatTraits>(
    &self,
    rounding_mode: Option<RoundingMode>,
    fp_state: Option<&mut FPState>,
    traits: DestFT
) -> Float<DestFT>
[src]

convert self to the floating-point format specified by traits.

pub fn convert_to_float<DestFT: FloatTraits + Default>(
    &self,
    rounding_mode: Option<RoundingMode>,
    fp_state: Option<&mut FPState>
) -> Float<DestFT>
[src]

convert self to the floating-point format specified by DestFT::default().

pub fn neg_assign(&mut self)[src]

negate and assign the result back to self. identical to self.toggle_sign()

pub fn neg(&self) -> Self[src]

compute the negation of self

pub fn abs_assign(&mut self)[src]

compute the absolute-value and assign the result back to self. identical to self.set_sign(Sign::Positive)

pub fn abs(&self) -> Self[src]

compute the absolute-value

pub fn copy_sign_assign<FT2: FloatTraits>(&mut self, sign_src: &Float<FT2>)[src]

set self's sign to the sign of sign_src

pub fn copy_sign<FT2: FloatTraits>(&self, sign_src: &Float<FT2>) -> Self[src]

construct a Float from self but with the sign of sign_src

pub fn compare(
    &self,
    rhs: &Self,
    quiet: bool,
    fp_state: Option<&mut FPState>
) -> Option<Ordering>
[src]

compare two Float values

pub fn compare_quiet(
    &self,
    rhs: &Self,
    fp_state: Option<&mut FPState>
) -> Option<Ordering>
[src]

compare two Float values

pub fn compare_signaling(
    &self,
    rhs: &Self,
    fp_state: Option<&mut FPState>
) -> Option<Ordering>
[src]

compare two Float values

pub fn from_bigint_with_traits(
    value: BigInt,
    rounding_mode: Option<RoundingMode>,
    fp_state: Option<&mut FPState>,
    traits: FT
) -> Self
[src]

convert from integer to floating-point

pub fn from_bigint(
    value: BigInt,
    rounding_mode: Option<RoundingMode>,
    fp_state: Option<&mut FPState>
) -> Self where
    FT: Default
[src]

convert from integer to floating-point

pub fn from_biguint_with_traits(
    value: BigUint,
    rounding_mode: Option<RoundingMode>,
    fp_state: Option<&mut FPState>,
    traits: FT
) -> Self
[src]

convert from integer to floating-point

pub fn from_biguint(
    value: BigUint,
    rounding_mode: Option<RoundingMode>,
    fp_state: Option<&mut FPState>
) -> Self where
    FT: Default
[src]

convert from integer to floating-point

pub fn from_u8_with_traits(
    value: u8,
    rounding_mode: Option<RoundingMode>,
    fp_state: Option<&mut FPState>,
    traits: FT
) -> Self
[src]

convert from integer to floating-point

pub fn from_u8(
    value: u8,
    rounding_mode: Option<RoundingMode>,
    fp_state: Option<&mut FPState>
) -> Self where
    FT: Default
[src]

convert from integer to floating-point

pub fn from_u16_with_traits(
    value: u16,
    rounding_mode: Option<RoundingMode>,
    fp_state: Option<&mut FPState>,
    traits: FT
) -> Self
[src]

convert from integer to floating-point

pub fn from_u16(
    value: u16,
    rounding_mode: Option<RoundingMode>,
    fp_state: Option<&mut FPState>
) -> Self where
    FT: Default
[src]

convert from integer to floating-point

pub fn from_u32_with_traits(
    value: u32,
    rounding_mode: Option<RoundingMode>,
    fp_state: Option<&mut FPState>,
    traits: FT
) -> Self
[src]

convert from integer to floating-point

pub fn from_u32(
    value: u32,
    rounding_mode: Option<RoundingMode>,
    fp_state: Option<&mut FPState>
) -> Self where
    FT: Default
[src]

convert from integer to floating-point

pub fn from_u64_with_traits(
    value: u64,
    rounding_mode: Option<RoundingMode>,
    fp_state: Option<&mut FPState>,
    traits: FT
) -> Self
[src]

convert from integer to floating-point

pub fn from_u64(
    value: u64,
    rounding_mode: Option<RoundingMode>,
    fp_state: Option<&mut FPState>
) -> Self where
    FT: Default
[src]

convert from integer to floating-point

pub fn from_u128_with_traits(
    value: u128,
    rounding_mode: Option<RoundingMode>,
    fp_state: Option<&mut FPState>,
    traits: FT
) -> Self
[src]

convert from integer to floating-point

pub fn from_u128(
    value: u128,
    rounding_mode: Option<RoundingMode>,
    fp_state: Option<&mut FPState>
) -> Self where
    FT: Default
[src]

convert from integer to floating-point

pub fn from_usize_with_traits(
    value: usize,
    rounding_mode: Option<RoundingMode>,
    fp_state: Option<&mut FPState>,
    traits: FT
) -> Self
[src]

convert from integer to floating-point

pub fn from_usize(
    value: usize,
    rounding_mode: Option<RoundingMode>,
    fp_state: Option<&mut FPState>
) -> Self where
    FT: Default
[src]

convert from integer to floating-point

pub fn from_i8_with_traits(
    value: i8,
    rounding_mode: Option<RoundingMode>,
    fp_state: Option<&mut FPState>,
    traits: FT
) -> Self
[src]

convert from integer to floating-point

pub fn from_i8(
    value: i8,
    rounding_mode: Option<RoundingMode>,
    fp_state: Option<&mut FPState>
) -> Self where
    FT: Default
[src]

convert from integer to floating-point

pub fn from_i16_with_traits(
    value: i16,
    rounding_mode: Option<RoundingMode>,
    fp_state: Option<&mut FPState>,
    traits: FT
) -> Self
[src]

convert from integer to floating-point

pub fn from_i16(
    value: i16,
    rounding_mode: Option<RoundingMode>,
    fp_state: Option<&mut FPState>
) -> Self where
    FT: Default
[src]

convert from integer to floating-point

pub fn from_i32_with_traits(
    value: i32,
    rounding_mode: Option<RoundingMode>,
    fp_state: Option<&mut FPState>,
    traits: FT
) -> Self
[src]

convert from integer to floating-point

pub fn from_i32(
    value: i32,
    rounding_mode: Option<RoundingMode>,
    fp_state: Option<&mut FPState>
) -> Self where
    FT: Default
[src]

convert from integer to floating-point

pub fn from_i64_with_traits(
    value: i64,
    rounding_mode: Option<RoundingMode>,
    fp_state: Option<&mut FPState>,
    traits: FT
) -> Self
[src]

convert from integer to floating-point

pub fn from_i64(
    value: i64,
    rounding_mode: Option<RoundingMode>,
    fp_state: Option<&mut FPState>
) -> Self where
    FT: Default
[src]

convert from integer to floating-point

pub fn from_i128_with_traits(
    value: i128,
    rounding_mode: Option<RoundingMode>,
    fp_state: Option<&mut FPState>,
    traits: FT
) -> Self
[src]

convert from integer to floating-point

pub fn from_i128(
    value: i128,
    rounding_mode: Option<RoundingMode>,
    fp_state: Option<&mut FPState>
) -> Self where
    FT: Default
[src]

convert from integer to floating-point

pub fn from_isize_with_traits(
    value: isize,
    rounding_mode: Option<RoundingMode>,
    fp_state: Option<&mut FPState>,
    traits: FT
) -> Self
[src]

convert from integer to floating-point

pub fn from_isize(
    value: isize,
    rounding_mode: Option<RoundingMode>,
    fp_state: Option<&mut FPState>
) -> Self where
    FT: Default
[src]

convert from integer to floating-point

pub fn to_bigint(
    &self,
    exact: bool,
    rounding_mode: Option<RoundingMode>,
    fp_state: Option<&mut FPState>
) -> Option<BigInt>
[src]

convert from floating-point to integer

pub fn to_biguint(
    &self,
    exact: bool,
    rounding_mode: Option<RoundingMode>,
    fp_state: Option<&mut FPState>
) -> Option<BigUint>
[src]

convert from floating-point to integer

pub fn to_u8(
    &self,
    exact: bool,
    rounding_mode: Option<RoundingMode>,
    fp_state: Option<&mut FPState>
) -> Option<u8>
[src]

convert from floating-point to integer

pub fn to_u16(
    &self,
    exact: bool,
    rounding_mode: Option<RoundingMode>,
    fp_state: Option<&mut FPState>
) -> Option<u16>
[src]

convert from floating-point to integer

pub fn to_u32(
    &self,
    exact: bool,
    rounding_mode: Option<RoundingMode>,
    fp_state: Option<&mut FPState>
) -> Option<u32>
[src]

convert from floating-point to integer

pub fn to_u64(
    &self,
    exact: bool,
    rounding_mode: Option<RoundingMode>,
    fp_state: Option<&mut FPState>
) -> Option<u64>
[src]

convert from floating-point to integer

pub fn to_u128(
    &self,
    exact: bool,
    rounding_mode: Option<RoundingMode>,
    fp_state: Option<&mut FPState>
) -> Option<u128>
[src]

convert from floating-point to integer

pub fn to_usize(
    &self,
    exact: bool,
    rounding_mode: Option<RoundingMode>,
    fp_state: Option<&mut FPState>
) -> Option<usize>
[src]

convert from floating-point to integer

pub fn to_i8(
    &self,
    exact: bool,
    rounding_mode: Option<RoundingMode>,
    fp_state: Option<&mut FPState>
) -> Option<i8>
[src]

convert from floating-point to integer

pub fn to_i16(
    &self,
    exact: bool,
    rounding_mode: Option<RoundingMode>,
    fp_state: Option<&mut FPState>
) -> Option<i16>
[src]

convert from floating-point to integer

pub fn to_i32(
    &self,
    exact: bool,
    rounding_mode: Option<RoundingMode>,
    fp_state: Option<&mut FPState>
) -> Option<i32>
[src]

convert from floating-point to integer

pub fn to_i64(
    &self,
    exact: bool,
    rounding_mode: Option<RoundingMode>,
    fp_state: Option<&mut FPState>
) -> Option<i64>
[src]

convert from floating-point to integer

pub fn to_i128(
    &self,
    exact: bool,
    rounding_mode: Option<RoundingMode>,
    fp_state: Option<&mut FPState>
) -> Option<i128>
[src]

convert from floating-point to integer

pub fn to_isize(
    &self,
    exact: bool,
    rounding_mode: Option<RoundingMode>,
    fp_state: Option<&mut FPState>
) -> Option<isize>
[src]

convert from floating-point to integer

pub fn rsqrt(
    &self,
    rounding_mode: Option<RoundingMode>,
    fp_state: Option<&mut FPState>
) -> Self
[src]

reciprocal square root -- computes 1 / sqrt(self)

Trait Implementations

impl<FT: Clone + FloatTraits> Clone for Float<FT> where
    FT::Bits: Clone
[src]

impl<FT: Copy + FloatTraits> Copy for Float<FT> where
    FT::Bits: Copy
[src]

impl<Bits: FloatBitsType, FT: FloatTraits<Bits = Bits>> Debug for Float<FT>[src]

impl<FT: FloatTraits + Default> Default for Float<FT>[src]

impl From<DynamicFloat> for Float<FloatProperties>[src]

impl From<Float<FloatProperties>> for DynamicFloat[src]

Auto Trait Implementations

impl<FT> RefUnwindSafe for Float<FT> where
    FT: RefUnwindSafe,
    <FT as FloatTraits>::Bits: RefUnwindSafe

impl<FT> Send for Float<FT> where
    FT: Send,
    <FT as FloatTraits>::Bits: Send

impl<FT> Sync for Float<FT> where
    FT: Sync,
    <FT as FloatTraits>::Bits: Sync

impl<FT> Unpin for Float<FT> where
    FT: Unpin,
    <FT as FloatTraits>::Bits: Unpin

impl<FT> UnwindSafe for Float<FT> where
    FT: UnwindSafe,
    <FT as FloatTraits>::Bits: UnwindSafe

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.