Skip to content

Commit

Permalink
Use the right target ratio in Algorithm M quickstart.
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
Robin Kruppe committed Feb 4, 2016
1 parent 13b5eda commit 25c9ac3
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/libcore/num/dec2flt/algorithm.rs
Expand Up @@ -278,7 +278,7 @@ fn quick_start<T: RawFloat>(u: &mut Big, v: &mut Big, k: &mut i16) {
// The target ratio is one where u/v is in an in-range significand. Thus our termination
// condition is log2(u / v) being the significand bits, plus/minus one.
// FIXME Looking at the second bit could improve the estimate and avoid some more divisions.
let target_ratio = f64::sig_bits() as i16;
let target_ratio = T::sig_bits() as i16;
let log2_u = u.bit_length() as i16;
let log2_v = v.bit_length() as i16;
let mut u_shift: i16 = 0;
Expand Down

0 comments on commit 25c9ac3

Please sign in to comment.