Skip to content

Commit 25c9ac3

Browse files
author
Robin Kruppe
committed
Use the right target ratio in Algorithm M quickstart.
Using f64's bit size probably wasn't actually *wrong*, but it would overshoot for no reason. This might have slowed down f32 parsing significantly.
1 parent 13b5eda commit 25c9ac3

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/libcore/num/dec2flt/algorithm.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -278,7 +278,7 @@ fn quick_start<T: RawFloat>(u: &mut Big, v: &mut Big, k: &mut i16) {
278278
// The target ratio is one where u/v is in an in-range significand. Thus our termination
279279
// condition is log2(u / v) being the significand bits, plus/minus one.
280280
// FIXME Looking at the second bit could improve the estimate and avoid some more divisions.
281-
let target_ratio = f64::sig_bits() as i16;
281+
let target_ratio = T::sig_bits() as i16;
282282
let log2_u = u.bit_length() as i16;
283283
let log2_v = v.bit_length() as i16;
284284
let mut u_shift: i16 = 0;

0 commit comments

Comments
 (0)