fix fppoint.max_norm
authoralfadur
Thu, 18 Oct 2018 06:50:21 +0300
changeset 13944 665b4c6612ee
parent 13943 1fa905aa4cdb
child 13945 1c30793b1cea
fix fppoint.max_norm
rust/fpnum/src/lib.rs
--- a/rust/fpnum/src/lib.rs	Thu Oct 18 06:46:32 2018 +0300
+++ b/rust/fpnum/src/lib.rs	Thu Oct 18 06:50:21 2018 +0300
@@ -342,7 +342,7 @@
 
     #[inline]
     pub fn max_norm(&self) -> FPNum {
-        std::cmp::max(self.x(), self.y())
+        std::cmp::max(self.x().abs(), self.y().abs())
     }
 
     #[inline]
@@ -574,4 +574,5 @@
     assert_eq!(n * p, p * n);
     assert_eq!(distance(4, 3), fp!(5));
     assert_eq!(p * fp!(-3), FPPoint::new(fp!(-3), fp!(6)));
+    assert_eq!(p.max_norm(), fp!(2));
 }
\ No newline at end of file