remove debug from float builder
This commit is contained in:
parent
865d7a7886
commit
665d528b87
@ -154,49 +154,33 @@ macro_rules! impl_into_float {
|
||||
// SBBB BBBB
|
||||
// 1001 1110 0000 0000
|
||||
let sign=if self.bits.is_negative(){(1 as $unsigned)<<(<$unsigned>::BITS-1)}else{0};
|
||||
println!("sign={sign}");
|
||||
let unsigned=self.bits.unsigned_abs();
|
||||
println!("unsigned={unsigned}");
|
||||
let most_significant_bit=unsigned.bits();
|
||||
println!("most_significant_bit={most_significant_bit}");
|
||||
let exp=if unsigned.is_zero(){
|
||||
0
|
||||
}else{
|
||||
let msb=most_significant_bit as $unsigned;
|
||||
println!("msb={msb}");
|
||||
let _127=((1 as $unsigned)<<($exponent_bits-1))-1;
|
||||
println!("_127={_127}");
|
||||
let msb_offset=msb+_127-1-F as $unsigned;
|
||||
println!("msb_offset={msb_offset}");
|
||||
msb_offset<<($mantissa_bits-1)
|
||||
};
|
||||
println!("exp={exp:#034b}");
|
||||
let digits=unsigned.digits();
|
||||
println!("digits={digits:?}");
|
||||
let digit_index=most_significant_bit>>DIGIT_SHIFT;
|
||||
println!("digit_index={digit_index}");
|
||||
let digit=digits[digit_index as usize];
|
||||
println!("digit={digit:#034b}");
|
||||
//How many bits does the mantissa take from this digit
|
||||
let take_bits=most_significant_bit-(digit_index<<DIGIT_SHIFT);
|
||||
println!("take_bits={take_bits}");
|
||||
let rest_of_mantissa=$mantissa_bits as i32-(take_bits as i32);
|
||||
println!("rest_of_mantissa={rest_of_mantissa}");
|
||||
let mut unmasked_mant=signed_shift(digit,rest_of_mantissa) as $unsigned;
|
||||
println!("umnt={unmasked_mant:#034b}");
|
||||
if 0<rest_of_mantissa&&digit_index!=0{
|
||||
//take the next digit down and shove some of its bits onto the bottom of the mantissa
|
||||
let digit=digits[digit_index as usize-1];
|
||||
let take_bits=most_significant_bit-((digit_index-1)<<DIGIT_SHIFT);
|
||||
let rest_of_mantissa=$mantissa_bits as i32-(take_bits as i32);
|
||||
let unmasked_mant2=signed_shift(digit,rest_of_mantissa) as $unsigned;
|
||||
println!("unmasked_mant2={unmasked_mant2:#034b}");
|
||||
unmasked_mant|=unmasked_mant2;
|
||||
}
|
||||
let mant=unmasked_mant&((1 as $unsigned)<<($mantissa_bits-1))-1;
|
||||
println!("mant={mant:#034b}");
|
||||
let bits=sign|exp|mant;
|
||||
println!("bits={bits:#034b}");
|
||||
<$output>::from_bits(bits)
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user