[clippy] u64 -> f64 conversion is precision loss
This commit is contained in:
parent
24cf088011
commit
2005b7d5ca
@ -20,6 +20,14 @@ fn count_prime_factor_exponent(prime: u64, mut nr: u64) -> u64 {
|
|||||||
fn prime_factors(nr: u64, primes: &[u64]) -> u64 {
|
fn prime_factors(nr: u64, primes: &[u64]) -> u64 {
|
||||||
let mut num_teilers = 1;
|
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;
|
let nr_sqrt = (nr as f64).sqrt().ceil() as u64;
|
||||||
|
|
||||||
for prime in primes {
|
for prime in primes {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user