Trait core::num::dec2flt::rawfp::RawFloat
[−]
[src]
pub trait RawFloat: Float + Copy + Debug + LowerExp + Mul<Output=Self> + Div<Output=Self> + Neg<Output=Self> { fn transmute(self) -> u64; fn from_bits(bits: u64) -> Self; fn unpack(self) -> Unpacked; fn from_int(x: u64) -> Self; fn short_fast_pow10(e: usize) -> Self; fn ceil_log5_of_max_sig() -> i16; fn max_normal_digits() -> usize; fn inf_cutoff() -> i64; fn zero_cutoff() -> i64; fn exp_bits() -> u8; fn sig_bits() -> u8; fn explicit_sig_bits() -> u8 { ... } fn max_exp() -> i16 { ... } fn min_exp() -> i16 { ... } fn max_exp_int() -> i16 { ... } fn max_encoded_exp() -> i16 { ... } fn min_exp_int() -> i16 { ... } fn max_sig() -> u64 { ... } fn min_sig() -> u64 { ... } }
dec2flt
): internal routines only exposed for testing
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.
Inherits from Float
because there is some overlap, but all the reused methods are trivial.
The "methods" (pseudo-constants) with default implementation should not be overriden.
Required Methods
fn transmute(self) -> u64
dec2flt
): internal routines only exposed for testing
Get the raw binary representation of the float.
fn from_bits(bits: u64) -> Self
dec2flt
): internal routines only exposed for testing
Transmute the raw binary representation into a float.
fn unpack(self) -> Unpacked
dec2flt
): internal routines only exposed for testing
Decode the float.
fn from_int(x: u64) -> Self
dec2flt
): internal routines only exposed for testing
Cast from a small integer that can be represented exactly. Panic if the integer can't be represented, the other code in this module makes sure to never let that happen.
fn short_fast_pow10(e: usize) -> Self
dec2flt
): internal routines only exposed for testing
Get the value 10e from a pre-computed table. Panics for e >= ceil_log5_of_max_sig().
fn ceil_log5_of_max_sig() -> i16
dec2flt
): internal routines only exposed for testing
What the name says. It's easier to hard code than juggling intrinsics and hoping LLVM constant folds it.
fn max_normal_digits() -> usize
dec2flt
): internal routines only exposed for testing
subnormals. Probably the decimal exponent of the maximum normal value, hence the name.
fn inf_cutoff() -> i64
dec2flt
): internal routines only exposed for testing
When the most significant decimal digit has a place value greater than this, the number is certainly rounded to infinity.
fn zero_cutoff() -> i64
dec2flt
): internal routines only exposed for testing
When the most significant decimal digit has a place value less than this, the number is certainly rounded to zero.
fn exp_bits() -> u8
dec2flt
): internal routines only exposed for testing
The number of bits in the exponent.
fn sig_bits() -> u8
dec2flt
): internal routines only exposed for testing
The number of bits in the singificand, including the hidden bit.
Provided Methods
fn explicit_sig_bits() -> u8
dec2flt
): internal routines only exposed for testing
The number of bits in the singificand, excluding the hidden bit.
fn max_exp() -> i16
dec2flt
): internal routines only exposed for testing
The maximum legal exponent in fractional representation.
fn min_exp() -> i16
dec2flt
): internal routines only exposed for testing
The minimum legal exponent in fractional representation, excluding subnormals.
fn max_exp_int() -> i16
dec2flt
): internal routines only exposed for testing
MAX_EXP
for integral representation, i.e., with the shift applied.
fn max_encoded_exp() -> i16
dec2flt
): internal routines only exposed for testing
MAX_EXP
encoded (i.e., with offset bias)
fn min_exp_int() -> i16
dec2flt
): internal routines only exposed for testing
MIN_EXP
for integral representation, i.e., with the shift applied.
fn max_sig() -> u64
dec2flt
): internal routines only exposed for testing
The maximum normalized singificand in integral representation.
fn min_sig() -> u64
dec2flt
): internal routines only exposed for testing
The minimal normalized significand in integral representation.