Skip to content

Commit 294ce40

Browse files
committed
Clippy fixes
1 parent fd52319 commit 294ce40

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

Diff for: src/hazmat/primecount.rs

+2-3
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,7 @@ pub fn estimate_pi_x<const LIMBS: usize>(x: &Uint<LIMBS>) -> Uint<LIMBS> {
1010
let ln_x = ln_x as f64;
1111
let ln_x_sq = ln_x * ln_x;
1212
let term2 = (1.0 + 1.0 / ln_x + 2.0 / (ln_x_sq) + 6.0 / (ln_x_sq * ln_x)) as u64;
13-
let pi_x = term1 * Uint::<LIMBS>::from_u64(term2);
14-
pi_x
13+
term1 * Uint::<LIMBS>::from_u64(term2)
1514
}
1615

1716
// Calculate the natural logarithm of a big integer using the relation ln(x) = log₂(x) / log₂(e).
@@ -40,7 +39,7 @@ mod tests {
4039
for exponent in 1..=35 {
4140
let x = U256::from_u128(10u128.pow(exponent));
4241
let ln_x = ln(&x);
43-
let expected_ln_x = (exponent as f64 * 2.302585092994046) as u64; // ln(10^exponent) = exponent * ln(10)
42+
let expected_ln_x = (exponent as f64 * core::f64::consts::LN_10) as u64; // ln(10^exponent) = exponent * ln(10)
4443
let delta = ln_x.abs_diff(expected_ln_x);
4544
assert!(
4645
delta < 2,

0 commit comments

Comments
 (0)