-
Notifications
You must be signed in to change notification settings - Fork 2
Open
Description
Example for how to extract the mantissa & exponent:
fn raw_mantissa_and_exponent<T: PrimitiveFloat>(x: T) -> (u64, u64) {
let bits = x.to_bits();
let mantissa = bits.mod_power_of_2(T::MANTISSA_WIDTH);
let exponent: u64 = (bits >> T::MANTISSA_WIDTH).exact_into();
let exponent = exponent.mod_power_of_2(T::EXPONENT_WIDTH);
(mantissa, exponent)
}Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels