]> gitweb.michael.orlitzky.com - spline3.git/blobdiff - src/Comparisons.hs
Add some convenience functions to write chunks/slices to bitmaps.
[spline3.git] / src / Comparisons.hs
index 6d8dc70d846e08159c9c4ae6ea49b11a530a25a2..d033159f23f827fa3776ca2c6dd2ac775780af91 100644 (file)
@@ -8,6 +8,17 @@ where
 epsilon :: Double
 epsilon = 0.0001
 
+-- | A tiny margin of error.
+theta :: Double
+theta = 0.0000000000001
+
+-- | x almost equals y if x is within 'theta' of y.
+nearly_equals :: Double -> Double -> Bool
+nearly_equals x y = (abs (x - y)) < theta
+
+-- | Nearly greater-than or equal-to.
+nearly_ge :: Double -> Double -> Bool
+x `nearly_ge` y = (x > y) || (x `nearly_equals` y)
 
 -- | x almost equals y if x is within 'epsilon' of y.
 almost_equals :: Double -> Double -> Bool