Skip to content

Commit 5bf04fd

Browse files
committed
Use global constant LOG2_10 in relevant places
1 parent e013911 commit 5bf04fd

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ fn count_decimal_digits(int: &BigInt) -> u64 {
9898
return 1;
9999
}
100100
// guess number of digits based on number of bits in UInt
101-
let mut digits = (int.bits() as f64 / 3.3219280949) as u64;
101+
let mut digits = (int.bits() as f64 / LOG2_10) as u64;
102102
let mut num = ten_to_the(digits);
103103
while *int >= num {
104104
num *= 10u8;
@@ -120,7 +120,7 @@ fn get_rounding_term(num: &BigInt) -> u8 {
120120
return 0;
121121
}
122122

123-
let digits = (num.bits() as f64 / 3.3219280949) as u64;
123+
let digits = (num.bits() as f64 / LOG2_10) as u64;
124124
let mut n = ten_to_the(digits);
125125

126126
// loop-method

0 commit comments

Comments
 (0)