diff --git a/src/main.rs b/src/main.rs index 928af1d..7a97081 100644 --- a/src/main.rs +++ b/src/main.rs @@ -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 {