fix to float

This commit is contained in:
Quaternions 2024-10-01 14:59:33 -07:00
parent c4a2778af1
commit a65eef3609

View File

@ -173,7 +173,7 @@ macro_rules! impl_into_float {
msb_offset<<($mantissa_bits-1) msb_offset<<($mantissa_bits-1)
}; };
let digits=unsigned.digits(); let digits=unsigned.digits();
let digit_index=most_significant_bit>>DIGIT_SHIFT; let digit_index=most_significant_bit.saturating_sub(1)>>DIGIT_SHIFT;
let digit=digits[digit_index as usize]; let digit=digits[digit_index as usize];
//How many bits does the mantissa take from this digit //How many bits does the mantissa take from this digit
let take_bits=most_significant_bit-(digit_index<<DIGIT_SHIFT); let take_bits=most_significant_bit-(digit_index<<DIGIT_SHIFT);