This commit is contained in:
Quaternions 2024-08-29 18:38:23 -07:00
parent 61aad93f8d
commit 0483c9eb27

View File

@ -75,7 +75,7 @@ impl<const CHUNKS:usize,Frac:Unsigned> Fixed<CHUNKS,Frac>
//cheat to make the types match
let wide_self=self.wide_mul(Fixed::<CHUNKS,Frac>::ONE);
for shift in (0..=max_shift).rev(){
let new_result=result|(Fixed::<CHUNKS,Frac>::EPSILON<<shift);
let new_result=result|Fixed::<CHUNKS,Frac>::from_bits(BInt::from_bits(bnum::BUint::power_of_two(shift)));
if new_result.wide_mul(new_result)<=wide_self{
result=new_result;
}