[clippy] u64 -> f64 conversion is precision loss

This commit is contained in:
ddidderr 2023-12-09 18:26:59 +01:00
parent 24cf088011
commit 2005b7d5ca
Signed by: ddidderr
GPG Key ID: 3841F1C27E6F0E14

View File

@ -20,6 +20,14 @@ fn count_prime_factor_exponent(prime: u64, mut nr: u64) -> u64 {
fn prime_factors(nr: u64, primes: &[u64]) -> u64 {
let mut num_teilers = 1;
// safety: nr <= 2.pow(53) must be fulfilled,
// otherwise we have a precision loss
assert!(nr <= 2u64.pow(53));
#[allow(
clippy::cast_sign_loss,
clippy::cast_possible_truncation,
clippy::cast_precision_loss
)]
let nr_sqrt = (nr as f64).sqrt().ceil() as u64;
for prime in primes {