@@ -891,22 +891,22 @@ unsafe fn dtoa(value: f64, mut buffer: *mut u8) -> *mut u8 {
891891 // has a fixed 128-bit fractional part. For example, 3 * 2**59 and 3 * 2**60
892892 // both have dec_exp = 2 and dividing them by 10**dec_exp would have the
893893 // decimal point in different (bit) positions without the shift:
894- // 3 * 2**59 / 100 = 1.72...e+16 (shift = 1 + 1)
895- // 3 * 2**60 / 100 = 3.45...e+16 (shift = 2 + 1)
896- let shift = bin_exp + pow10_bin_exp + 1 ;
894+ // 3 * 2**59 / 100 = 1.72...e+16 (exp_shift = 1 + 1)
895+ // 3 * 2**60 / 100 = 3.45...e+16 (exp_shift = 2 + 1)
896+ let exp_shift = bin_exp + pow10_bin_exp + 1 ;
897897
898898 if regular {
899899 let uint128 {
900900 hi : integral,
901901 lo : fractional,
902- } = umul192_upper128 ( pow10_hi, pow10_lo, bin_sig << shift ) ;
902+ } = umul192_upper128 ( pow10_hi, pow10_lo, bin_sig << exp_shift ) ;
903903 let digit = integral % 10 ;
904904
905905 const NUM_FRACTIONAL_BITS : i32 = 60 ;
906906 const TEN : u64 = 10 << NUM_FRACTIONAL_BITS ;
907907 // Fixed-point remainder of the scaled significand modulo 10.
908908 let rem10 = ( digit << NUM_FRACTIONAL_BITS ) | ( fractional >> 4 ) ;
909- let half_ulp = pow10_hi >> ( 5 - shift ) ;
909+ let half_ulp = pow10_hi >> ( 5 - exp_shift ) ;
910910 let upper = rem10 + half_ulp;
911911
912912 // An optimization from yy_double by Yaoyuan Guo:
@@ -937,9 +937,9 @@ unsafe fn dtoa(value: f64, mut buffer: *mut u8) -> *mut u8 {
937937 // Compute the estimates of lower and upper bounds of the rounding interval
938938 // by multiplying them by the power of 10 and applying modified rounding.
939939 let lsb = bin_sig & 1 ;
940- let lower = ( bin_sig_shifted - ( u64:: from ( regular) + 1 ) ) << shift ;
940+ let lower = ( bin_sig_shifted - ( u64:: from ( regular) + 1 ) ) << exp_shift ;
941941 let lower = umul192_upper64_inexact_to_odd ( pow10_hi, pow10_lo, lower) + lsb;
942- let upper = ( bin_sig_shifted + 2 ) << shift ;
942+ let upper = ( bin_sig_shifted + 2 ) << exp_shift ;
943943 let upper = umul192_upper64_inexact_to_odd ( pow10_hi, pow10_lo, upper) - lsb;
944944
945945 // The idea of using a single shorter candidate is by Cassio Neri.
@@ -949,7 +949,8 @@ unsafe fn dtoa(value: f64, mut buffer: *mut u8) -> *mut u8 {
949949 return unsafe { write ( buffer, shorter, dec_exp) } ;
950950 }
951951
952- let scaled_sig = umul192_upper64_inexact_to_odd ( pow10_hi, pow10_lo, bin_sig_shifted << shift) ;
952+ let scaled_sig =
953+ umul192_upper64_inexact_to_odd ( pow10_hi, pow10_lo, bin_sig_shifted << exp_shift) ;
953954 let dec_sig_under = scaled_sig >> 2 ;
954955 let dec_sig_over = dec_sig_under + 1 ;
955956
0 commit comments