[librsvg/librsvg-2.52: 15/18] Increase the epsilon for Rect::approx_eq()




commit 0c4399554756fb149f6b1fe63bf2fdced5e32645
Author: Federico Mena Quintero <federico gnome org>
Date:   Mon May 9 20:06:08 2022 -0500

    Increase the epsilon for Rect::approx_eq()
    
    The default from the float-cmp crate is
    
            F64Margin {
                epsilon: f64::EPSILON,
                ulps: 4
            }
    
    but it looks like we need a bigger epsilon...
    
    Part-of: <https://gitlab.gnome.org/GNOME/librsvg/-/merge_requests/697>

 src/rect.rs | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
---
diff --git a/src/rect.rs b/src/rect.rs
index 7de0cd4cb..8ec4f1ed2 100644
--- a/src/rect.rs
+++ b/src/rect.rs
@@ -159,10 +159,10 @@ mod rect {
         pub fn approx_eq(&self, other: &Self) -> bool {
             // FIXME: this is super fishy; shouldn't we be using 2x the epsilon against the width/height
             // instead of the raw coordinates?
-            approx_eq!(f64, self.x0, other.x0)
-                && approx_eq!(f64, self.y0, other.y0)
-                && approx_eq!(f64, self.x1, other.x1)
-                && approx_eq!(f64, self.y1, other.y1)
+            approx_eq!(f64, self.x0, other.x0, epsilon = 0.0001)
+                && approx_eq!(f64, self.y0, other.y0, epsilon = 0.0001)
+                && approx_eq!(f64, self.x1, other.x1, epsilon = 0.0001)
+                && approx_eq!(f64, self.y1, other.y1, epsilon = 0.00012)
         }
     }
 }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]