pub trait Float:
Copy
+ PartialEq
+ PartialOrd
+ AsBitswhere
Self::Bits: Cast<Self::BiasedExponent> + Cast<Self::Significand>,
Self::BiasedExponent: Cast<Self::Exponent>,
Self::Exponent: Sub<Output = Self::Exponent>,
Self::Significand: Add<Output = Self::Significand>,{
type BiasedExponent;
type Exponent;
type Significand;
const EXP_BITS: u16;
const SIGNIF_BITS: u16;
const SIGN_MASK: Self::Bits;
const EXP_MASK: Self::Bits;
const SIGNIF_MASK: Self::Bits;
const EXP_BIAS: Self::Exponent;
const BITS: u16 = _;
// Provided methods
fn sign_bit(self) -> bool { ... }
fn biased_exponent(self) -> Self::BiasedExponent { ... }
fn exponent(self) -> Self::Exponent { ... }
fn stored_significand(self) -> Self::Significand { ... }
fn significand(self) -> Self::Significand { ... }
fn fraction(self) -> Self::Significand { ... }
fn raw_components(self) -> (bool, Self::BiasedExponent, Self::Significand) { ... }
fn components(self) -> (bool, Self::Exponent, Self::Significand) { ... }
fn explain(self)
where Self: Debug,
Self::BiasedExponent: Debug,
Self::Exponent: Debug,
Self::Significand: Debug { ... }
}
Expand description
Types that represent a floating point number.
Required Associated Constants§
Sourceconst SIGNIF_BITS: u16
const SIGNIF_BITS: u16
The number of bits of the stored significand (not counting the implicit bit).
Sourceconst SIGNIF_MASK: Self::Bits
const SIGNIF_MASK: Self::Bits
The mask for the stored significand bits (no implicit bit).
Provided Associated Constants§
Sourceconst BITS: u16 = _
const BITS: u16 = _
The number of bits (defaults to <Self as AsBits>::Bits::BITS
).
Required Associated Types§
Sourcetype BiasedExponent
type BiasedExponent
Type for the the biased exponent.
Sourcetype Significand
type Significand
Type for the significand, both with and without implicit bit.
Provided Methods§
Sourcefn biased_exponent(self) -> Self::BiasedExponent
fn biased_exponent(self) -> Self::BiasedExponent
The biased exponent, as it is stored in the bit representation.
Sourcefn stored_significand(self) -> Self::Significand
fn stored_significand(self) -> Self::Significand
The significand without the implicit bit, as it is stored in the bit representation.
Synonym of Float::fraction
.
Sourcefn significand(self) -> Self::Significand
fn significand(self) -> Self::Significand
The true significand, with the implicit bit added.
Sourcefn fraction(self) -> Self::Significand
fn fraction(self) -> Self::Significand
The significand without the implicit bit, as it is stored in the bit representation.
Synonym of Float::stored_significand
.
Sourcefn raw_components(self) -> (bool, Self::BiasedExponent, Self::Significand)
fn raw_components(self) -> (bool, Self::BiasedExponent, Self::Significand)
The triple of stored components: sign bit, biased exponent, significand without implicit bit.
Sourcefn components(self) -> (bool, Self::Exponent, Self::Significand)
fn components(self) -> (bool, Self::Exponent, Self::Significand)
The triple of true components: sign bit, exponent, significand with implicit bit.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.