pub struct DynamicFloat {
pub fp_state: FPState,
pub value: Float<FloatProperties>,
/* private fields */
}
Expand description
Float
with attached FPState
and dynamically settable FloatProperties
Fields§
§fp_state: FPState
floating-point state
value: Float<FloatProperties>
floating-point value; also accessible through *self
Implementations§
Source§impl DynamicFloat
impl DynamicFloat
Sourcepub fn new(properties: FloatProperties) -> Self
pub fn new(properties: FloatProperties) -> Self
create from properties
Sourcepub fn from_bits(bits: BigUint, properties: FloatProperties) -> Option<Self>
pub fn from_bits(bits: BigUint, properties: FloatProperties) -> Option<Self>
create from bits
and properties
Sourcepub fn positive_zero(properties: FloatProperties) -> Self
pub fn positive_zero(properties: FloatProperties) -> Self
get the positive zero value
Sourcepub fn negative_zero(properties: FloatProperties) -> Self
pub fn negative_zero(properties: FloatProperties) -> Self
get the negative zero value
Sourcepub fn signed_zero(sign: Sign, properties: FloatProperties) -> Self
pub fn signed_zero(sign: Sign, properties: FloatProperties) -> Self
get the zero with sign sign
Sourcepub fn positive_infinity(properties: FloatProperties) -> Self
pub fn positive_infinity(properties: FloatProperties) -> Self
get the positive infinity value
Sourcepub fn negative_infinity(properties: FloatProperties) -> Self
pub fn negative_infinity(properties: FloatProperties) -> Self
get the negative infinity value
Sourcepub fn signed_infinity(sign: Sign, properties: FloatProperties) -> Self
pub fn signed_infinity(sign: Sign, properties: FloatProperties) -> Self
get the infinity with sign sign
Sourcepub fn quiet_nan(properties: FloatProperties) -> Self
pub fn quiet_nan(properties: FloatProperties) -> Self
get the canonical quiet NaN, which is also just the canonical NaN
Sourcepub fn signaling_nan(properties: FloatProperties) -> Self
pub fn signaling_nan(properties: FloatProperties) -> Self
get the canonical signaling NaN
Sourcepub fn into_quiet_nan(self) -> Self
pub fn into_quiet_nan(self) -> Self
convert self
into a quiet NaN
Sourcepub fn to_quiet_nan(&self) -> Self
pub fn to_quiet_nan(&self) -> Self
convert self
into a quiet NaN
Sourcepub fn signed_max_normal(sign: Sign, properties: FloatProperties) -> Self
pub fn signed_max_normal(sign: Sign, properties: FloatProperties) -> Self
get the largest finite value with sign sign
Sourcepub fn signed_min_subnormal(sign: Sign, properties: FloatProperties) -> Self
pub fn signed_min_subnormal(sign: Sign, properties: FloatProperties) -> Self
get the subnormal value closest to zero with sign sign
Sourcepub fn from_real_algebraic_number(
value: &RealAlgebraicNumber,
rounding_mode: Option<RoundingMode>,
fp_state: Option<FPState>,
properties: FloatProperties,
) -> Self
pub fn from_real_algebraic_number( value: &RealAlgebraicNumber, rounding_mode: Option<RoundingMode>, fp_state: Option<FPState>, properties: FloatProperties, ) -> Self
round from a RealAlgebraicNumber
into a floating-point value.
rounding_mode
only used for this conversion
Source§impl DynamicFloat
impl DynamicFloat
Sourcepub fn add_with_rounding_mode(
&self,
rhs: &Self,
rounding_mode: Option<RoundingMode>,
) -> Self
pub fn add_with_rounding_mode( &self, rhs: &Self, rounding_mode: Option<RoundingMode>, ) -> Self
add two DynamicFloat
values, returning the result
Sourcepub fn checked_add_with_rounding_mode(
&self,
rhs: &Self,
rounding_mode: Option<RoundingMode>,
) -> Result<Self, FPStateMergeFailed>
pub fn checked_add_with_rounding_mode( &self, rhs: &Self, rounding_mode: Option<RoundingMode>, ) -> Result<Self, FPStateMergeFailed>
add two DynamicFloat
values, returning the result
Source§impl DynamicFloat
impl DynamicFloat
Sourcepub fn sub_with_rounding_mode(
&self,
rhs: &Self,
rounding_mode: Option<RoundingMode>,
) -> Self
pub fn sub_with_rounding_mode( &self, rhs: &Self, rounding_mode: Option<RoundingMode>, ) -> Self
subtract two DynamicFloat
values, returning the result
Sourcepub fn checked_sub_with_rounding_mode(
&self,
rhs: &Self,
rounding_mode: Option<RoundingMode>,
) -> Result<Self, FPStateMergeFailed>
pub fn checked_sub_with_rounding_mode( &self, rhs: &Self, rounding_mode: Option<RoundingMode>, ) -> Result<Self, FPStateMergeFailed>
subtract two DynamicFloat
values, returning the result
Source§impl DynamicFloat
impl DynamicFloat
Sourcepub fn mul_with_rounding_mode(
&self,
rhs: &Self,
rounding_mode: Option<RoundingMode>,
) -> Self
pub fn mul_with_rounding_mode( &self, rhs: &Self, rounding_mode: Option<RoundingMode>, ) -> Self
multiply two DynamicFloat
values, returning the result
Sourcepub fn checked_mul_with_rounding_mode(
&self,
rhs: &Self,
rounding_mode: Option<RoundingMode>,
) -> Result<Self, FPStateMergeFailed>
pub fn checked_mul_with_rounding_mode( &self, rhs: &Self, rounding_mode: Option<RoundingMode>, ) -> Result<Self, FPStateMergeFailed>
multiply two DynamicFloat
values, returning the result
Source§impl DynamicFloat
impl DynamicFloat
Sourcepub fn div_with_rounding_mode(
&self,
rhs: &Self,
rounding_mode: Option<RoundingMode>,
) -> Self
pub fn div_with_rounding_mode( &self, rhs: &Self, rounding_mode: Option<RoundingMode>, ) -> Self
divide two DynamicFloat
values, returning the result
Sourcepub fn checked_div_with_rounding_mode(
&self,
rhs: &Self,
rounding_mode: Option<RoundingMode>,
) -> Result<Self, FPStateMergeFailed>
pub fn checked_div_with_rounding_mode( &self, rhs: &Self, rounding_mode: Option<RoundingMode>, ) -> Result<Self, FPStateMergeFailed>
divide two DynamicFloat
values, returning the result
Source§impl DynamicFloat
impl DynamicFloat
Sourcepub fn ieee754_remainder(
&self,
rhs: &Self,
rounding_mode: Option<RoundingMode>,
) -> Self
pub fn ieee754_remainder( &self, rhs: &Self, rounding_mode: Option<RoundingMode>, ) -> Self
calculate the IEEE 754 remainder of two DynamicFloat
values, returning the result
Sourcepub fn checked_ieee754_remainder(
&self,
rhs: &Self,
rounding_mode: Option<RoundingMode>,
) -> Result<Self, FPStateMergeFailed>
pub fn checked_ieee754_remainder( &self, rhs: &Self, rounding_mode: Option<RoundingMode>, ) -> Result<Self, FPStateMergeFailed>
calculate the IEEE 754 remainder of two DynamicFloat
values, returning the result
Source§impl DynamicFloat
impl DynamicFloat
Sourcepub fn fused_mul_add(
&self,
factor: &Self,
term: &Self,
rounding_mode: Option<RoundingMode>,
) -> Self
pub fn fused_mul_add( &self, factor: &Self, term: &Self, rounding_mode: Option<RoundingMode>, ) -> Self
calculate the result of (self * factor) + term
rounding only once, returning the result
Sourcepub fn checked_fused_mul_add(
&self,
factor: &Self,
term: &Self,
rounding_mode: Option<RoundingMode>,
) -> Result<Self, FPStateMergeFailed>
pub fn checked_fused_mul_add( &self, factor: &Self, term: &Self, rounding_mode: Option<RoundingMode>, ) -> Result<Self, FPStateMergeFailed>
calculate the result of (self * factor) + term
rounding only once, returning the result
Source§impl DynamicFloat
impl DynamicFloat
Sourcepub fn round_to_integer(
&self,
exact: bool,
rounding_mode: Option<RoundingMode>,
) -> (Option<BigInt>, FPState)
pub fn round_to_integer( &self, exact: bool, rounding_mode: Option<RoundingMode>, ) -> (Option<BigInt>, FPState)
round self
to an integer, returning the result as a tuple of an integer or None
, and FPState
Source§impl DynamicFloat
impl DynamicFloat
Sourcepub fn round_to_integral(
&self,
exact: bool,
rounding_mode: Option<RoundingMode>,
) -> Self
pub fn round_to_integral( &self, exact: bool, rounding_mode: Option<RoundingMode>, ) -> Self
round self
to an integer, returning the result as a DynamicFloat
Source§impl DynamicFloat
impl DynamicFloat
Sourcepub fn next_up_or_down(&self, up_or_down: UpOrDown) -> Self
pub fn next_up_or_down(&self, up_or_down: UpOrDown) -> Self
compute the result of next_up
or next_down
Source§impl DynamicFloat
impl DynamicFloat
Source§impl DynamicFloat
impl DynamicFloat
Source§impl DynamicFloat
impl DynamicFloat
Source§impl DynamicFloat
impl DynamicFloat
Sourcepub fn scale_b(
&self,
scale: BigInt,
rounding_mode: Option<RoundingMode>,
) -> Self
pub fn scale_b( &self, scale: BigInt, rounding_mode: Option<RoundingMode>, ) -> Self
get self * 2^scale
Source§impl DynamicFloat
impl DynamicFloat
Sourcepub fn sqrt(&self, rounding_mode: Option<RoundingMode>) -> Self
pub fn sqrt(&self, rounding_mode: Option<RoundingMode>) -> Self
get the square-root of self
Source§impl DynamicFloat
impl DynamicFloat
Sourcepub fn convert_from_dynamic_float(
src: &Self,
rounding_mode: Option<RoundingMode>,
properties: FloatProperties,
) -> Self
pub fn convert_from_dynamic_float( src: &Self, rounding_mode: Option<RoundingMode>, properties: FloatProperties, ) -> Self
convert src
to the floating-point format specified by properties
.
Sourcepub fn convert_from_float<SrcFT: FloatTraits>(
src: &Float<SrcFT>,
rounding_mode: Option<RoundingMode>,
fp_state: Option<FPState>,
properties: FloatProperties,
) -> Self
pub fn convert_from_float<SrcFT: FloatTraits>( src: &Float<SrcFT>, rounding_mode: Option<RoundingMode>, fp_state: Option<FPState>, properties: FloatProperties, ) -> Self
convert src
to the floating-point format specified by properties
.
Sourcepub fn convert_to_dynamic_float(
&self,
rounding_mode: Option<RoundingMode>,
properties: FloatProperties,
) -> Self
pub fn convert_to_dynamic_float( &self, rounding_mode: Option<RoundingMode>, properties: FloatProperties, ) -> Self
convert self
to the floating-point format specified by properties
.
Sourcepub fn copy_sign<FT2: FloatTraits>(&self, sign_src: &Float<FT2>) -> Self
pub fn copy_sign<FT2: FloatTraits>(&self, sign_src: &Float<FT2>) -> Self
construct a DynamicFloat
from self
but with the sign of sign_src
Sourcepub fn compare(&self, rhs: &Self, quiet: bool) -> (Option<Ordering>, FPState)
pub fn compare(&self, rhs: &Self, quiet: bool) -> (Option<Ordering>, FPState)
compare two DynamicFloat
values
Sourcepub fn checked_compare(
&self,
rhs: &Self,
quiet: bool,
) -> Result<(Option<Ordering>, FPState), FPStateMergeFailed>
pub fn checked_compare( &self, rhs: &Self, quiet: bool, ) -> Result<(Option<Ordering>, FPState), FPStateMergeFailed>
compare two DynamicFloat
values
Sourcepub fn compare_quiet(&self, rhs: &Self) -> (Option<Ordering>, FPState)
pub fn compare_quiet(&self, rhs: &Self) -> (Option<Ordering>, FPState)
compare two DynamicFloat
values
Sourcepub fn checked_compare_quiet(
&self,
rhs: &Self,
) -> Result<(Option<Ordering>, FPState), FPStateMergeFailed>
pub fn checked_compare_quiet( &self, rhs: &Self, ) -> Result<(Option<Ordering>, FPState), FPStateMergeFailed>
compare two DynamicFloat
values
Sourcepub fn compare_signaling(&self, rhs: &Self) -> (Option<Ordering>, FPState)
pub fn compare_signaling(&self, rhs: &Self) -> (Option<Ordering>, FPState)
compare two DynamicFloat
values
Sourcepub fn checked_compare_signaling(
&self,
rhs: &Self,
) -> Result<(Option<Ordering>, FPState), FPStateMergeFailed>
pub fn checked_compare_signaling( &self, rhs: &Self, ) -> Result<(Option<Ordering>, FPState), FPStateMergeFailed>
compare two DynamicFloat
values
Source§impl DynamicFloat
impl DynamicFloat
Sourcepub fn from_bigint(
value: BigInt,
rounding_mode: Option<RoundingMode>,
fp_state: Option<FPState>,
properties: FloatProperties,
) -> Self
pub fn from_bigint( value: BigInt, rounding_mode: Option<RoundingMode>, fp_state: Option<FPState>, properties: FloatProperties, ) -> Self
convert from integer to floating-point.
rounding_mode
only used for this conversion.
Source§impl DynamicFloat
impl DynamicFloat
Sourcepub fn from_biguint(
value: BigUint,
rounding_mode: Option<RoundingMode>,
fp_state: Option<FPState>,
properties: FloatProperties,
) -> Self
pub fn from_biguint( value: BigUint, rounding_mode: Option<RoundingMode>, fp_state: Option<FPState>, properties: FloatProperties, ) -> Self
convert from integer to floating-point.
rounding_mode
only used for this conversion.
Source§impl DynamicFloat
impl DynamicFloat
Sourcepub fn from_u8(
value: u8,
rounding_mode: Option<RoundingMode>,
fp_state: Option<FPState>,
properties: FloatProperties,
) -> Self
pub fn from_u8( value: u8, rounding_mode: Option<RoundingMode>, fp_state: Option<FPState>, properties: FloatProperties, ) -> Self
convert from integer to floating-point.
rounding_mode
only used for this conversion.
Source§impl DynamicFloat
impl DynamicFloat
Sourcepub fn from_u16(
value: u16,
rounding_mode: Option<RoundingMode>,
fp_state: Option<FPState>,
properties: FloatProperties,
) -> Self
pub fn from_u16( value: u16, rounding_mode: Option<RoundingMode>, fp_state: Option<FPState>, properties: FloatProperties, ) -> Self
convert from integer to floating-point.
rounding_mode
only used for this conversion.
Source§impl DynamicFloat
impl DynamicFloat
Sourcepub fn from_u32(
value: u32,
rounding_mode: Option<RoundingMode>,
fp_state: Option<FPState>,
properties: FloatProperties,
) -> Self
pub fn from_u32( value: u32, rounding_mode: Option<RoundingMode>, fp_state: Option<FPState>, properties: FloatProperties, ) -> Self
convert from integer to floating-point.
rounding_mode
only used for this conversion.
Source§impl DynamicFloat
impl DynamicFloat
Sourcepub fn from_u64(
value: u64,
rounding_mode: Option<RoundingMode>,
fp_state: Option<FPState>,
properties: FloatProperties,
) -> Self
pub fn from_u64( value: u64, rounding_mode: Option<RoundingMode>, fp_state: Option<FPState>, properties: FloatProperties, ) -> Self
convert from integer to floating-point.
rounding_mode
only used for this conversion.
Source§impl DynamicFloat
impl DynamicFloat
Sourcepub fn from_u128(
value: u128,
rounding_mode: Option<RoundingMode>,
fp_state: Option<FPState>,
properties: FloatProperties,
) -> Self
pub fn from_u128( value: u128, rounding_mode: Option<RoundingMode>, fp_state: Option<FPState>, properties: FloatProperties, ) -> Self
convert from integer to floating-point.
rounding_mode
only used for this conversion.
Source§impl DynamicFloat
impl DynamicFloat
Sourcepub fn from_usize(
value: usize,
rounding_mode: Option<RoundingMode>,
fp_state: Option<FPState>,
properties: FloatProperties,
) -> Self
pub fn from_usize( value: usize, rounding_mode: Option<RoundingMode>, fp_state: Option<FPState>, properties: FloatProperties, ) -> Self
convert from integer to floating-point.
rounding_mode
only used for this conversion.
Source§impl DynamicFloat
impl DynamicFloat
Sourcepub fn from_i8(
value: i8,
rounding_mode: Option<RoundingMode>,
fp_state: Option<FPState>,
properties: FloatProperties,
) -> Self
pub fn from_i8( value: i8, rounding_mode: Option<RoundingMode>, fp_state: Option<FPState>, properties: FloatProperties, ) -> Self
convert from integer to floating-point.
rounding_mode
only used for this conversion.
Source§impl DynamicFloat
impl DynamicFloat
Sourcepub fn from_i16(
value: i16,
rounding_mode: Option<RoundingMode>,
fp_state: Option<FPState>,
properties: FloatProperties,
) -> Self
pub fn from_i16( value: i16, rounding_mode: Option<RoundingMode>, fp_state: Option<FPState>, properties: FloatProperties, ) -> Self
convert from integer to floating-point.
rounding_mode
only used for this conversion.
Source§impl DynamicFloat
impl DynamicFloat
Sourcepub fn from_i32(
value: i32,
rounding_mode: Option<RoundingMode>,
fp_state: Option<FPState>,
properties: FloatProperties,
) -> Self
pub fn from_i32( value: i32, rounding_mode: Option<RoundingMode>, fp_state: Option<FPState>, properties: FloatProperties, ) -> Self
convert from integer to floating-point.
rounding_mode
only used for this conversion.
Source§impl DynamicFloat
impl DynamicFloat
Sourcepub fn from_i64(
value: i64,
rounding_mode: Option<RoundingMode>,
fp_state: Option<FPState>,
properties: FloatProperties,
) -> Self
pub fn from_i64( value: i64, rounding_mode: Option<RoundingMode>, fp_state: Option<FPState>, properties: FloatProperties, ) -> Self
convert from integer to floating-point.
rounding_mode
only used for this conversion.
Source§impl DynamicFloat
impl DynamicFloat
Sourcepub fn from_i128(
value: i128,
rounding_mode: Option<RoundingMode>,
fp_state: Option<FPState>,
properties: FloatProperties,
) -> Self
pub fn from_i128( value: i128, rounding_mode: Option<RoundingMode>, fp_state: Option<FPState>, properties: FloatProperties, ) -> Self
convert from integer to floating-point.
rounding_mode
only used for this conversion.
Source§impl DynamicFloat
impl DynamicFloat
Sourcepub fn from_isize(
value: isize,
rounding_mode: Option<RoundingMode>,
fp_state: Option<FPState>,
properties: FloatProperties,
) -> Self
pub fn from_isize( value: isize, rounding_mode: Option<RoundingMode>, fp_state: Option<FPState>, properties: FloatProperties, ) -> Self
convert from integer to floating-point.
rounding_mode
only used for this conversion.
Source§impl DynamicFloat
impl DynamicFloat
Source§impl DynamicFloat
impl DynamicFloat
Sourcepub fn to_biguint(
&self,
exact: bool,
rounding_mode: Option<RoundingMode>,
) -> (Option<BigUint>, FPState)
pub fn to_biguint( &self, exact: bool, rounding_mode: Option<RoundingMode>, ) -> (Option<BigUint>, FPState)
convert self
to an integer, returning the result as a tuple of an integer or None
, and FPState
Source§impl DynamicFloat
impl DynamicFloat
Source§impl DynamicFloat
impl DynamicFloat
Source§impl DynamicFloat
impl DynamicFloat
Source§impl DynamicFloat
impl DynamicFloat
Source§impl DynamicFloat
impl DynamicFloat
Source§impl DynamicFloat
impl DynamicFloat
Source§impl DynamicFloat
impl DynamicFloat
Source§impl DynamicFloat
impl DynamicFloat
Source§impl DynamicFloat
impl DynamicFloat
Source§impl DynamicFloat
impl DynamicFloat
Source§impl DynamicFloat
impl DynamicFloat
Source§impl DynamicFloat
impl DynamicFloat
Source§impl DynamicFloat
impl DynamicFloat
Sourcepub fn rsqrt(&self, rounding_mode: Option<RoundingMode>) -> Self
pub fn rsqrt(&self, rounding_mode: Option<RoundingMode>) -> Self
compute reciprocal square-root (1.0 / sqrt(self)
)
Methods from Deref<Target = Float<FloatProperties>>§
Sourcepub fn properties(&self) -> FloatProperties
pub fn properties(&self) -> FloatProperties
get the FloatProperties
Sourcepub fn toggle_sign(&mut self)
pub fn toggle_sign(&mut self)
toggle the sign
Sourcepub fn exponent_field(&self) -> Bits
pub fn exponent_field(&self) -> Bits
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
Sourcepub fn set_exponent_field(&mut self, exponent: Bits)
pub fn set_exponent_field(&mut self, exponent: Bits)
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
Sourcepub fn mantissa_field(&self) -> Bits
pub fn mantissa_field(&self) -> Bits
get the mantissa field
Sourcepub fn set_mantissa_field(&mut self, mantissa: Bits)
pub fn set_mantissa_field(&mut self, mantissa: Bits)
set the mantissa field
Sourcepub fn mantissa_field_msb(&self) -> bool
pub fn mantissa_field_msb(&self) -> bool
get the mantissa field’s MSB
Sourcepub fn set_mantissa_field_msb(&mut self, mantissa_msb: bool)
pub fn set_mantissa_field_msb(&mut self, mantissa_msb: bool)
set the mantissa field’s MSB
Sourcepub fn class(&self) -> FloatClass
pub fn class(&self) -> FloatClass
calculate the FloatClass
Sourcepub fn is_negative_infinity(&self) -> bool
pub fn is_negative_infinity(&self) -> bool
return true
if self.class()
is NegativeInfinity
Sourcepub fn is_negative_normal(&self) -> bool
pub fn is_negative_normal(&self) -> bool
return true
if self.class()
is NegativeNormal
Sourcepub fn is_negative_subnormal(&self) -> bool
pub fn is_negative_subnormal(&self) -> bool
return true
if self.class()
is NegativeSubnormal
Sourcepub fn is_negative_zero(&self) -> bool
pub fn is_negative_zero(&self) -> bool
return true
if self.class()
is NegativeZero
Sourcepub fn is_positive_infinity(&self) -> bool
pub fn is_positive_infinity(&self) -> bool
return true
if self.class()
is PositiveInfinity
Sourcepub fn is_positive_normal(&self) -> bool
pub fn is_positive_normal(&self) -> bool
return true
if self.class()
is PositiveNormal
Sourcepub fn is_positive_subnormal(&self) -> bool
pub fn is_positive_subnormal(&self) -> bool
return true
if self.class()
is PositiveSubnormal
Sourcepub fn is_positive_zero(&self) -> bool
pub fn is_positive_zero(&self) -> bool
return true
if self.class()
is PositiveZero
Sourcepub fn is_quiet_nan(&self) -> bool
pub fn is_quiet_nan(&self) -> bool
return true
if self.class()
is QuietNaN
Sourcepub fn is_signaling_nan(&self) -> bool
pub fn is_signaling_nan(&self) -> bool
return true
if self.class()
is SignalingNaN
Sourcepub fn is_infinity(&self) -> bool
pub fn is_infinity(&self) -> bool
return true
if self
is infinity
Sourcepub fn is_normal(&self) -> bool
pub fn is_normal(&self) -> bool
return true
if self.class()
is NegativeNormal
or PositiveNormal
Sourcepub fn is_subnormal(&self) -> bool
pub fn is_subnormal(&self) -> bool
return true
if self
is subnormal
Sourcepub fn is_subnormal_or_zero(&self) -> bool
pub fn is_subnormal_or_zero(&self) -> bool
return true
if self
is subnormal or zero
Sourcepub fn to_ratio(&self) -> Option<Ratio<BigInt>>
pub fn to_ratio(&self) -> Option<Ratio<BigInt>>
get the mathematical value of self
as a Ratio<BigInt>
.
if self
is NaN or infinite, returns None
.
Sourcepub fn to_real_algebraic_number(&self) -> Option<RealAlgebraicNumber>
pub fn to_real_algebraic_number(&self) -> Option<RealAlgebraicNumber>
get the mathematical value of self
as a RealAlgebraicNumber
.
if self
is NaN or infinite, returns None
.
Sourcepub fn to_quiet_nan(&self) -> Self
pub fn to_quiet_nan(&self) -> Self
convert self
into a quiet NaN
Sourcepub fn add(
&self,
rhs: &Self,
rounding_mode: Option<RoundingMode>,
fp_state: Option<&mut FPState>,
) -> Self
pub fn add( &self, rhs: &Self, rounding_mode: Option<RoundingMode>, fp_state: Option<&mut FPState>, ) -> Self
add floating-point numbers
Sourcepub fn sub(
&self,
rhs: &Self,
rounding_mode: Option<RoundingMode>,
fp_state: Option<&mut FPState>,
) -> Self
pub fn sub( &self, rhs: &Self, rounding_mode: Option<RoundingMode>, fp_state: Option<&mut FPState>, ) -> Self
subtract floating-point numbers
Sourcepub fn mul(
&self,
rhs: &Self,
rounding_mode: Option<RoundingMode>,
fp_state: Option<&mut FPState>,
) -> Self
pub fn mul( &self, rhs: &Self, rounding_mode: Option<RoundingMode>, fp_state: Option<&mut FPState>, ) -> Self
multiply floating-point numbers
Sourcepub fn div(
&self,
rhs: &Self,
rounding_mode: Option<RoundingMode>,
fp_state: Option<&mut FPState>,
) -> Self
pub fn div( &self, rhs: &Self, rounding_mode: Option<RoundingMode>, fp_state: Option<&mut FPState>, ) -> Self
divide floating-point numbers
Sourcepub fn ieee754_remainder(
&self,
rhs: &Self,
rounding_mode: Option<RoundingMode>,
fp_state: Option<&mut FPState>,
) -> Self
pub fn ieee754_remainder( &self, rhs: &Self, rounding_mode: Option<RoundingMode>, fp_state: Option<&mut FPState>, ) -> Self
compute the IEEE 754 remainder of two floating-point numbers
Sourcepub fn fused_mul_add(
&self,
factor: &Self,
term: &Self,
rounding_mode: Option<RoundingMode>,
fp_state: Option<&mut FPState>,
) -> Self
pub fn fused_mul_add( &self, factor: &Self, term: &Self, rounding_mode: Option<RoundingMode>, fp_state: Option<&mut FPState>, ) -> Self
calculate the result of (self * factor) + term
rounding only once, returning the result
Sourcepub fn round_to_integer(
&self,
exact: bool,
rounding_mode: Option<RoundingMode>,
fp_state: Option<&mut FPState>,
) -> Option<BigInt>
pub fn round_to_integer( &self, exact: bool, rounding_mode: Option<RoundingMode>, fp_state: Option<&mut FPState>, ) -> Option<BigInt>
round self
to an integer, returning the result as an integer or None
Sourcepub fn round_to_integral(
&self,
exact: bool,
rounding_mode: Option<RoundingMode>,
fp_state: Option<&mut FPState>,
) -> Self
pub fn round_to_integral( &self, exact: bool, rounding_mode: Option<RoundingMode>, fp_state: Option<&mut FPState>, ) -> Self
round self
to an integer, returning the result as a Float
Sourcepub fn normalize(&mut self)
pub fn normalize(&mut self)
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).
Sourcepub fn next_up_or_down(
&self,
up_or_down: UpOrDown,
fp_state: Option<&mut FPState>,
) -> Self
pub fn next_up_or_down( &self, up_or_down: UpOrDown, fp_state: Option<&mut FPState>, ) -> Self
compute the result of next_up
or next_down
Sourcepub fn next_up(&self, fp_state: Option<&mut FPState>) -> Self
pub fn next_up(&self, fp_state: Option<&mut FPState>) -> Self
compute the least floating-point number that compares greater than self
Sourcepub fn next_down(&self, fp_state: Option<&mut FPState>) -> Self
pub fn next_down(&self, fp_state: Option<&mut FPState>) -> Self
compute the greatest floating-point number that compares less than self
Sourcepub fn log_b(&self, fp_state: Option<&mut FPState>) -> Option<BigInt>
pub fn log_b(&self, fp_state: Option<&mut FPState>) -> Option<BigInt>
get the floor of the log base 2 of the absolute value of self
Sourcepub fn scale_b(
&self,
scale: BigInt,
rounding_mode: Option<RoundingMode>,
fp_state: Option<&mut FPState>,
) -> Self
pub fn scale_b( &self, scale: BigInt, rounding_mode: Option<RoundingMode>, fp_state: Option<&mut FPState>, ) -> Self
get self * 2^scale
Sourcepub fn sqrt(
&self,
rounding_mode: Option<RoundingMode>,
fp_state: Option<&mut FPState>,
) -> Self
pub fn sqrt( &self, rounding_mode: Option<RoundingMode>, fp_state: Option<&mut FPState>, ) -> Self
get the square-root of self
Sourcepub fn convert_to_float_with_traits<DestFT: FloatTraits>(
&self,
rounding_mode: Option<RoundingMode>,
fp_state: Option<&mut FPState>,
traits: DestFT,
) -> Float<DestFT>
pub fn convert_to_float_with_traits<DestFT: FloatTraits>( &self, rounding_mode: Option<RoundingMode>, fp_state: Option<&mut FPState>, traits: DestFT, ) -> Float<DestFT>
convert self
to the floating-point format specified by traits
.
Sourcepub fn convert_to_float<DestFT: FloatTraits + Default>(
&self,
rounding_mode: Option<RoundingMode>,
fp_state: Option<&mut FPState>,
) -> Float<DestFT>
pub fn convert_to_float<DestFT: FloatTraits + Default>( &self, rounding_mode: Option<RoundingMode>, fp_state: Option<&mut FPState>, ) -> Float<DestFT>
convert self
to the floating-point format specified by DestFT::default()
.
Sourcepub fn neg_assign(&mut self)
pub fn neg_assign(&mut self)
negate and assign the result back to self
.
identical to self.toggle_sign()
Sourcepub fn abs_assign(&mut self)
pub fn abs_assign(&mut self)
compute the absolute-value and assign the result back to self
.
identical to self.set_sign(Sign::Positive)
Sourcepub fn copy_sign_assign<FT2: FloatTraits>(&mut self, sign_src: &Float<FT2>)
pub fn copy_sign_assign<FT2: FloatTraits>(&mut self, sign_src: &Float<FT2>)
set self
’s sign to the sign of sign_src
Sourcepub fn copy_sign<FT2: FloatTraits>(&self, sign_src: &Float<FT2>) -> Self
pub fn copy_sign<FT2: FloatTraits>(&self, sign_src: &Float<FT2>) -> Self
construct a Float
from self
but with the sign of sign_src
Sourcepub fn compare(
&self,
rhs: &Self,
quiet: bool,
fp_state: Option<&mut FPState>,
) -> Option<Ordering>
pub fn compare( &self, rhs: &Self, quiet: bool, fp_state: Option<&mut FPState>, ) -> Option<Ordering>
compare two Float
values
Sourcepub fn compare_quiet(
&self,
rhs: &Self,
fp_state: Option<&mut FPState>,
) -> Option<Ordering>
pub fn compare_quiet( &self, rhs: &Self, fp_state: Option<&mut FPState>, ) -> Option<Ordering>
compare two Float
values
Sourcepub fn compare_signaling(
&self,
rhs: &Self,
fp_state: Option<&mut FPState>,
) -> Option<Ordering>
pub fn compare_signaling( &self, rhs: &Self, fp_state: Option<&mut FPState>, ) -> Option<Ordering>
compare two Float
values
Sourcepub fn to_bigint(
&self,
exact: bool,
rounding_mode: Option<RoundingMode>,
fp_state: Option<&mut FPState>,
) -> Option<BigInt>
pub fn to_bigint( &self, exact: bool, rounding_mode: Option<RoundingMode>, fp_state: Option<&mut FPState>, ) -> Option<BigInt>
convert from floating-point to integer
Sourcepub fn to_biguint(
&self,
exact: bool,
rounding_mode: Option<RoundingMode>,
fp_state: Option<&mut FPState>,
) -> Option<BigUint>
pub fn to_biguint( &self, exact: bool, rounding_mode: Option<RoundingMode>, fp_state: Option<&mut FPState>, ) -> Option<BigUint>
convert from floating-point to integer
Sourcepub fn to_u8(
&self,
exact: bool,
rounding_mode: Option<RoundingMode>,
fp_state: Option<&mut FPState>,
) -> Option<u8>
pub fn to_u8( &self, exact: bool, rounding_mode: Option<RoundingMode>, fp_state: Option<&mut FPState>, ) -> Option<u8>
convert from floating-point to integer
Sourcepub fn to_u16(
&self,
exact: bool,
rounding_mode: Option<RoundingMode>,
fp_state: Option<&mut FPState>,
) -> Option<u16>
pub fn to_u16( &self, exact: bool, rounding_mode: Option<RoundingMode>, fp_state: Option<&mut FPState>, ) -> Option<u16>
convert from floating-point to integer
Sourcepub fn to_u32(
&self,
exact: bool,
rounding_mode: Option<RoundingMode>,
fp_state: Option<&mut FPState>,
) -> Option<u32>
pub fn to_u32( &self, exact: bool, rounding_mode: Option<RoundingMode>, fp_state: Option<&mut FPState>, ) -> Option<u32>
convert from floating-point to integer
Sourcepub fn to_u64(
&self,
exact: bool,
rounding_mode: Option<RoundingMode>,
fp_state: Option<&mut FPState>,
) -> Option<u64>
pub fn to_u64( &self, exact: bool, rounding_mode: Option<RoundingMode>, fp_state: Option<&mut FPState>, ) -> Option<u64>
convert from floating-point to integer
Sourcepub fn to_u128(
&self,
exact: bool,
rounding_mode: Option<RoundingMode>,
fp_state: Option<&mut FPState>,
) -> Option<u128>
pub fn to_u128( &self, exact: bool, rounding_mode: Option<RoundingMode>, fp_state: Option<&mut FPState>, ) -> Option<u128>
convert from floating-point to integer
Sourcepub fn to_usize(
&self,
exact: bool,
rounding_mode: Option<RoundingMode>,
fp_state: Option<&mut FPState>,
) -> Option<usize>
pub fn to_usize( &self, exact: bool, rounding_mode: Option<RoundingMode>, fp_state: Option<&mut FPState>, ) -> Option<usize>
convert from floating-point to integer
Sourcepub fn to_i8(
&self,
exact: bool,
rounding_mode: Option<RoundingMode>,
fp_state: Option<&mut FPState>,
) -> Option<i8>
pub fn to_i8( &self, exact: bool, rounding_mode: Option<RoundingMode>, fp_state: Option<&mut FPState>, ) -> Option<i8>
convert from floating-point to integer
Sourcepub fn to_i16(
&self,
exact: bool,
rounding_mode: Option<RoundingMode>,
fp_state: Option<&mut FPState>,
) -> Option<i16>
pub fn to_i16( &self, exact: bool, rounding_mode: Option<RoundingMode>, fp_state: Option<&mut FPState>, ) -> Option<i16>
convert from floating-point to integer
Sourcepub fn to_i32(
&self,
exact: bool,
rounding_mode: Option<RoundingMode>,
fp_state: Option<&mut FPState>,
) -> Option<i32>
pub fn to_i32( &self, exact: bool, rounding_mode: Option<RoundingMode>, fp_state: Option<&mut FPState>, ) -> Option<i32>
convert from floating-point to integer
Sourcepub fn to_i64(
&self,
exact: bool,
rounding_mode: Option<RoundingMode>,
fp_state: Option<&mut FPState>,
) -> Option<i64>
pub fn to_i64( &self, exact: bool, rounding_mode: Option<RoundingMode>, fp_state: Option<&mut FPState>, ) -> Option<i64>
convert from floating-point to integer
Sourcepub fn to_i128(
&self,
exact: bool,
rounding_mode: Option<RoundingMode>,
fp_state: Option<&mut FPState>,
) -> Option<i128>
pub fn to_i128( &self, exact: bool, rounding_mode: Option<RoundingMode>, fp_state: Option<&mut FPState>, ) -> Option<i128>
convert from floating-point to integer
Trait Implementations§
Source§impl<'a, 'b> Add<&'a DynamicFloat> for &'b DynamicFloat
impl<'a, 'b> Add<&'a DynamicFloat> for &'b DynamicFloat
Source§type Output = DynamicFloat
type Output = DynamicFloat
+
operator.Source§fn add(self, rhs: &DynamicFloat) -> DynamicFloat
fn add(self, rhs: &DynamicFloat) -> DynamicFloat
+
operation. Read moreSource§impl Add<&DynamicFloat> for DynamicFloat
impl Add<&DynamicFloat> for DynamicFloat
Source§type Output = DynamicFloat
type Output = DynamicFloat
+
operator.Source§fn add(self, rhs: &DynamicFloat) -> DynamicFloat
fn add(self, rhs: &DynamicFloat) -> DynamicFloat
+
operation. Read moreSource§impl Add<DynamicFloat> for &DynamicFloat
impl Add<DynamicFloat> for &DynamicFloat
Source§type Output = DynamicFloat
type Output = DynamicFloat
+
operator.Source§fn add(self, rhs: DynamicFloat) -> DynamicFloat
fn add(self, rhs: DynamicFloat) -> DynamicFloat
+
operation. Read moreSource§impl Add for DynamicFloat
impl Add for DynamicFloat
Source§type Output = DynamicFloat
type Output = DynamicFloat
+
operator.Source§fn add(self, rhs: DynamicFloat) -> DynamicFloat
fn add(self, rhs: DynamicFloat) -> DynamicFloat
+
operation. Read moreSource§impl AddAssign<&DynamicFloat> for DynamicFloat
impl AddAssign<&DynamicFloat> for DynamicFloat
Source§fn add_assign(&mut self, rhs: &DynamicFloat)
fn add_assign(&mut self, rhs: &DynamicFloat)
+=
operation. Read moreSource§impl AddAssign for DynamicFloat
impl AddAssign for DynamicFloat
Source§fn add_assign(&mut self, rhs: DynamicFloat)
fn add_assign(&mut self, rhs: DynamicFloat)
+=
operation. Read moreSource§impl Clone for DynamicFloat
impl Clone for DynamicFloat
Source§fn clone(&self) -> DynamicFloat
fn clone(&self) -> DynamicFloat
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreSource§impl Debug for DynamicFloat
impl Debug for DynamicFloat
Source§impl Deref for DynamicFloat
impl Deref for DynamicFloat
Source§fn deref(&self) -> &Float<FloatProperties>
fn deref(&self) -> &Float<FloatProperties>
returns &self.value
Source§type Target = Float<FloatProperties>
type Target = Float<FloatProperties>
Source§impl DerefMut for DynamicFloat
impl DerefMut for DynamicFloat
Source§fn deref_mut(&mut self) -> &mut Float<FloatProperties>
fn deref_mut(&mut self) -> &mut Float<FloatProperties>
returns &mut self.value
Source§impl<'a, 'b> Div<&'a DynamicFloat> for &'b DynamicFloat
impl<'a, 'b> Div<&'a DynamicFloat> for &'b DynamicFloat
Source§type Output = DynamicFloat
type Output = DynamicFloat
/
operator.Source§fn div(self, rhs: &DynamicFloat) -> DynamicFloat
fn div(self, rhs: &DynamicFloat) -> DynamicFloat
/
operation. Read moreSource§impl Div<&DynamicFloat> for DynamicFloat
impl Div<&DynamicFloat> for DynamicFloat
Source§type Output = DynamicFloat
type Output = DynamicFloat
/
operator.Source§fn div(self, rhs: &DynamicFloat) -> DynamicFloat
fn div(self, rhs: &DynamicFloat) -> DynamicFloat
/
operation. Read moreSource§impl Div<DynamicFloat> for &DynamicFloat
impl Div<DynamicFloat> for &DynamicFloat
Source§type Output = DynamicFloat
type Output = DynamicFloat
/
operator.Source§fn div(self, rhs: DynamicFloat) -> DynamicFloat
fn div(self, rhs: DynamicFloat) -> DynamicFloat
/
operation. Read moreSource§impl Div for DynamicFloat
impl Div for DynamicFloat
Source§type Output = DynamicFloat
type Output = DynamicFloat
/
operator.Source§fn div(self, rhs: DynamicFloat) -> DynamicFloat
fn div(self, rhs: DynamicFloat) -> DynamicFloat
/
operation. Read moreSource§impl DivAssign<&DynamicFloat> for DynamicFloat
impl DivAssign<&DynamicFloat> for DynamicFloat
Source§fn div_assign(&mut self, rhs: &DynamicFloat)
fn div_assign(&mut self, rhs: &DynamicFloat)
/=
operation. Read moreSource§impl DivAssign for DynamicFloat
impl DivAssign for DynamicFloat
Source§fn div_assign(&mut self, rhs: DynamicFloat)
fn div_assign(&mut self, rhs: DynamicFloat)
/=
operation. Read moreSource§impl From<DynamicFloat> for Float<FloatProperties>
impl From<DynamicFloat> for Float<FloatProperties>
Source§fn from(value: DynamicFloat) -> Self
fn from(value: DynamicFloat) -> Self
Source§impl From<Float<FloatProperties>> for DynamicFloat
impl From<Float<FloatProperties>> for DynamicFloat
Source§fn from(value: Float<FloatProperties>) -> Self
fn from(value: Float<FloatProperties>) -> Self
Source§impl<'a, 'b> Mul<&'a DynamicFloat> for &'b DynamicFloat
impl<'a, 'b> Mul<&'a DynamicFloat> for &'b DynamicFloat
Source§type Output = DynamicFloat
type Output = DynamicFloat
*
operator.Source§fn mul(self, rhs: &DynamicFloat) -> DynamicFloat
fn mul(self, rhs: &DynamicFloat) -> DynamicFloat
*
operation. Read moreSource§impl Mul<&DynamicFloat> for DynamicFloat
impl Mul<&DynamicFloat> for DynamicFloat
Source§type Output = DynamicFloat
type Output = DynamicFloat
*
operator.Source§fn mul(self, rhs: &DynamicFloat) -> DynamicFloat
fn mul(self, rhs: &DynamicFloat) -> DynamicFloat
*
operation. Read moreSource§impl Mul<DynamicFloat> for &DynamicFloat
impl Mul<DynamicFloat> for &DynamicFloat
Source§type Output = DynamicFloat
type Output = DynamicFloat
*
operator.Source§fn mul(self, rhs: DynamicFloat) -> DynamicFloat
fn mul(self, rhs: DynamicFloat) -> DynamicFloat
*
operation. Read moreSource§impl Mul for DynamicFloat
impl Mul for DynamicFloat
Source§type Output = DynamicFloat
type Output = DynamicFloat
*
operator.Source§fn mul(self, rhs: DynamicFloat) -> DynamicFloat
fn mul(self, rhs: DynamicFloat) -> DynamicFloat
*
operation. Read moreSource§impl MulAssign<&DynamicFloat> for DynamicFloat
impl MulAssign<&DynamicFloat> for DynamicFloat
Source§fn mul_assign(&mut self, rhs: &DynamicFloat)
fn mul_assign(&mut self, rhs: &DynamicFloat)
*=
operation. Read moreSource§impl MulAssign for DynamicFloat
impl MulAssign for DynamicFloat
Source§fn mul_assign(&mut self, rhs: DynamicFloat)
fn mul_assign(&mut self, rhs: DynamicFloat)
*=
operation. Read moreSource§impl Neg for &DynamicFloat
impl Neg for &DynamicFloat
Source§type Output = DynamicFloat
type Output = DynamicFloat
-
operator.Source§fn neg(self) -> DynamicFloat
fn neg(self) -> DynamicFloat
-
operation. Read moreSource§impl Neg for DynamicFloat
impl Neg for DynamicFloat
Source§type Output = DynamicFloat
type Output = DynamicFloat
-
operator.Source§fn neg(self) -> DynamicFloat
fn neg(self) -> DynamicFloat
-
operation. Read moreSource§impl<'a, 'b> Sub<&'a DynamicFloat> for &'b DynamicFloat
impl<'a, 'b> Sub<&'a DynamicFloat> for &'b DynamicFloat
Source§type Output = DynamicFloat
type Output = DynamicFloat
-
operator.Source§fn sub(self, rhs: &DynamicFloat) -> DynamicFloat
fn sub(self, rhs: &DynamicFloat) -> DynamicFloat
-
operation. Read moreSource§impl Sub<&DynamicFloat> for DynamicFloat
impl Sub<&DynamicFloat> for DynamicFloat
Source§type Output = DynamicFloat
type Output = DynamicFloat
-
operator.Source§fn sub(self, rhs: &DynamicFloat) -> DynamicFloat
fn sub(self, rhs: &DynamicFloat) -> DynamicFloat
-
operation. Read moreSource§impl Sub<DynamicFloat> for &DynamicFloat
impl Sub<DynamicFloat> for &DynamicFloat
Source§type Output = DynamicFloat
type Output = DynamicFloat
-
operator.Source§fn sub(self, rhs: DynamicFloat) -> DynamicFloat
fn sub(self, rhs: DynamicFloat) -> DynamicFloat
-
operation. Read moreSource§impl Sub for DynamicFloat
impl Sub for DynamicFloat
Source§type Output = DynamicFloat
type Output = DynamicFloat
-
operator.Source§fn sub(self, rhs: DynamicFloat) -> DynamicFloat
fn sub(self, rhs: DynamicFloat) -> DynamicFloat
-
operation. Read moreSource§impl SubAssign<&DynamicFloat> for DynamicFloat
impl SubAssign<&DynamicFloat> for DynamicFloat
Source§fn sub_assign(&mut self, rhs: &DynamicFloat)
fn sub_assign(&mut self, rhs: &DynamicFloat)
-=
operation. Read moreSource§impl SubAssign for DynamicFloat
impl SubAssign for DynamicFloat
Source§fn sub_assign(&mut self, rhs: DynamicFloat)
fn sub_assign(&mut self, rhs: DynamicFloat)
-=
operation. Read more