--- a/rust/integral-geometry/src/lib.rs Thu Jul 04 21:40:50 2019 +0300
+++ b/rust/integral-geometry/src/lib.rs Fri Jul 05 21:16:33 2019 +0300
@@ -1,4 +1,4 @@
-use fpnum::{distance, fp, FPNum, FPPoint};
+use fpnum::{fp, integral_sqrt, FPNum, FPPoint};
use std::{
cmp::{max, min},
ops::{Add, AddAssign, Div, DivAssign, Mul, MulAssign, RangeInclusive, Sub, SubAssign},
@@ -45,7 +45,8 @@
#[inline]
pub fn integral_norm(self) -> u32 {
- distance(self.x, self.y).abs_round()
+ let sqr = (self.x as u64).pow(2) + (self.y as u64).pow(2);
+ integral_sqrt(sqr) as u32
}
#[inline]