pub trait RawFloat: Sized + Div<Output = Self> + Neg<Output = Self> + Mul<Output = Self> + Add<Output = Self> + LowerExp + PartialEq + PartialOrd + Default + Clone + Copy + Debug {
Show 16 associated constants and 5 methods
const INFINITY: Self;
const NEG_INFINITY: Self;
const NAN: Self;
const NEG_NAN: Self;
const MANTISSA_EXPLICIT_BITS: usize;
const MIN_EXPONENT_ROUND_TO_EVEN: i32;
const MAX_EXPONENT_ROUND_TO_EVEN: i32;
const MIN_EXPONENT_FAST_PATH: i64;
const MAX_EXPONENT_FAST_PATH: i64;
const MAX_EXPONENT_DISGUISED_FAST_PATH: i64;
const MINIMUM_EXPONENT: i32;
const INFINITE_POWER: i32;
const SIGN_INDEX: usize;
const SMALLEST_POWER_OF_TEN: i32;
const LARGEST_POWER_OF_TEN: i32;
const MAX_MANTISSA_FAST_PATH: u64 = _;
// Required methods
fn from_u64(v: u64) -> Self;
fn from_u64_bits(v: u64) -> Self;
fn pow10_fast_path(exponent: usize) -> Self;
fn classify(self) -> FpCategory;
fn integer_decode(self) -> (u64, i16, i8);
}
🔬This is a nightly-only experimental API. (
dec2flt
)Expand description
A helper trait to avoid duplicating basically all the conversion code for f32
and f64
.
See the parent module’s doc comment for why this is necessary.
Should never ever be implemented for other types or be used outside the dec2flt module.
Required Associated Constants§
sourceconst NEG_INFINITY: Self
const NEG_INFINITY: Self
🔬This is a nightly-only experimental API. (
dec2flt
)sourceconst MANTISSA_EXPLICIT_BITS: usize
const MANTISSA_EXPLICIT_BITS: usize
🔬This is a nightly-only experimental API. (
dec2flt
)The number of bits in the significand, excluding the hidden bit.
sourceconst MIN_EXPONENT_ROUND_TO_EVEN: i32
const MIN_EXPONENT_ROUND_TO_EVEN: i32
🔬This is a nightly-only experimental API. (
dec2flt
)sourceconst MAX_EXPONENT_ROUND_TO_EVEN: i32
const MAX_EXPONENT_ROUND_TO_EVEN: i32
🔬This is a nightly-only experimental API. (
dec2flt
)sourceconst MIN_EXPONENT_FAST_PATH: i64
const MIN_EXPONENT_FAST_PATH: i64
🔬This is a nightly-only experimental API. (
dec2flt
)sourceconst MAX_EXPONENT_FAST_PATH: i64
const MAX_EXPONENT_FAST_PATH: i64
🔬This is a nightly-only experimental API. (
dec2flt
)sourceconst MAX_EXPONENT_DISGUISED_FAST_PATH: i64
const MAX_EXPONENT_DISGUISED_FAST_PATH: i64
🔬This is a nightly-only experimental API. (
dec2flt
)sourceconst MINIMUM_EXPONENT: i32
const MINIMUM_EXPONENT: i32
🔬This is a nightly-only experimental API. (
dec2flt
)sourceconst INFINITE_POWER: i32
const INFINITE_POWER: i32
🔬This is a nightly-only experimental API. (
dec2flt
)sourceconst SIGN_INDEX: usize
const SIGN_INDEX: usize
🔬This is a nightly-only experimental API. (
dec2flt
)sourceconst SMALLEST_POWER_OF_TEN: i32
const SMALLEST_POWER_OF_TEN: i32
🔬This is a nightly-only experimental API. (
dec2flt
)sourceconst LARGEST_POWER_OF_TEN: i32
const LARGEST_POWER_OF_TEN: i32
🔬This is a nightly-only experimental API. (
dec2flt
)Provided Associated Constants§
sourceconst MAX_MANTISSA_FAST_PATH: u64 = _
const MAX_MANTISSA_FAST_PATH: u64 = _
🔬This is a nightly-only experimental API. (
dec2flt
)Required Methods§
sourcefn from_u64(v: u64) -> Self
fn from_u64(v: u64) -> Self
🔬This is a nightly-only experimental API. (
dec2flt
)Convert integer into float through an as cast. This is only called in the fast-path algorithm, and therefore will not lose precision, since the value will always have only if the value is <= Self::MAX_MANTISSA_FAST_PATH.
sourcefn from_u64_bits(v: u64) -> Self
fn from_u64_bits(v: u64) -> Self
🔬This is a nightly-only experimental API. (
dec2flt
)Performs a raw transmutation from an integer.
sourcefn pow10_fast_path(exponent: usize) -> Self
fn pow10_fast_path(exponent: usize) -> Self
🔬This is a nightly-only experimental API. (
dec2flt
)Get a small power-of-ten for fast-path multiplication.
sourcefn classify(self) -> FpCategory
fn classify(self) -> FpCategory
🔬This is a nightly-only experimental API. (
dec2flt
)Returns the category that this number falls into.
sourcefn integer_decode(self) -> (u64, i16, i8)
fn integer_decode(self) -> (u64, i16, i8)
🔬This is a nightly-only experimental API. (
dec2flt
)Returns the mantissa, exponent and sign as integers.