File tree Expand file tree Collapse file tree 2 files changed +6
-6
lines changed Expand file tree Collapse file tree 2 files changed +6
-6
lines changed Original file line number Diff line number Diff line change @@ -13,7 +13,7 @@ mod int_to_float {
1313 let a = ( i << n) >> 8 ; // Significant bits, with bit 24 still in tact.
1414 let b = ( i << n) << 24 ; // Insignificant bits, only relevant for rounding.
1515 let m = a + ( ( b - ( b >> 31 & !a) ) >> 31 ) ; // Add one when we need to round up. Break ties to even.
16- let e = 157 - n as u32 ; // Exponent plus 127, minus one.
16+ let e = 157 - n; // Exponent plus 127, minus one.
1717 ( e << 23 ) + m // + not |, so the mantissa can overflow into the exponent.
1818 }
1919
@@ -42,8 +42,8 @@ mod int_to_float {
4242 return 0 ;
4343 }
4444 let n = i. leading_zeros ( ) ;
45- let a = ( ( i << n) >> 11 ) as u64 ; // Significant bits, with bit 53 still in tact.
46- let b = ( ( i << n) << 53 ) as u64 ; // Insignificant bits, only relevant for rounding.
45+ let a = ( i << n) >> 11 ; // Significant bits, with bit 53 still in tact.
46+ let b = ( i << n) << 53 ; // Insignificant bits, only relevant for rounding.
4747 let m = a + ( ( b - ( b >> 63 & !a) ) >> 63 ) ; // Add one when we need to round up. Break ties to even.
4848 let e = 1085 - n as u64 ; // Exponent plus 1023, minus one.
4949 ( e << 52 ) + m // + not |, so the mantissa can overflow into the exponent.
Original file line number Diff line number Diff line change @@ -135,11 +135,11 @@ where
135135
136136 let mut correction: u32 =
137137 negate_u32 ( ( ( reciprocal as u64 ) . wrapping_mul ( q31b as u64 ) >> 32 ) as u32 ) ;
138- reciprocal = ( ( reciprocal as u64 ) . wrapping_mul ( correction as u64 ) as u64 >> 31 ) as u32 ;
138+ reciprocal = ( ( reciprocal as u64 ) . wrapping_mul ( correction as u64 ) >> 31 ) as u32 ;
139139 correction = negate_u32 ( ( ( reciprocal as u64 ) . wrapping_mul ( q31b as u64 ) >> 32 ) as u32 ) ;
140- reciprocal = ( ( reciprocal as u64 ) . wrapping_mul ( correction as u64 ) as u64 >> 31 ) as u32 ;
140+ reciprocal = ( ( reciprocal as u64 ) . wrapping_mul ( correction as u64 ) >> 31 ) as u32 ;
141141 correction = negate_u32 ( ( ( reciprocal as u64 ) . wrapping_mul ( q31b as u64 ) >> 32 ) as u32 ) ;
142- reciprocal = ( ( reciprocal as u64 ) . wrapping_mul ( correction as u64 ) as u64 >> 31 ) as u32 ;
142+ reciprocal = ( ( reciprocal as u64 ) . wrapping_mul ( correction as u64 ) >> 31 ) as u32 ;
143143
144144 // Exhaustive testing shows that the error in reciprocal after three steps
145145 // is in the interval [-0x1.f58108p-31, 0x1.d0e48cp-29], in line with our
You can’t perform that action at this time.
0 commit comments