packages feed

intervals 0.4.1 → 0.4.2

raw patch · 3 files changed

+12/−1 lines, 3 files

Files

CHANGELOG.markdown view
@@ -1,3 +1,7 @@+0.4.2+-----+* Added `clamp`+ 0.4 --- * Distributive Interval
intervals.cabal view
@@ -1,5 +1,5 @@ name:              intervals-version:           0.4.1+version:           0.4.2 synopsis:          Interval Arithmetic description:   A 'Numeric.Interval.Interval' is a closed, convex set of floating point values.
src/Numeric/Interval.hs view
@@ -40,6 +40,7 @@   , isSubsetOf   , certainly, (<!), (<=!), (==!), (>=!), (>!)   , possibly, (<?), (<=?), (==?), (>=?), (>?)+  , clamp   , idouble   , ifloat   ) where@@ -720,6 +721,12 @@         eq = cmp EQ EQ         gt = cmp GT EQ {-# INLINE possibly #-}++-- | The nearest value to that supplied which is contained in the interval.+clamp :: Ord a => Interval a -> a -> a+clamp (I a b) x | x < a     = a+                | x > b     = b+                | otherwise = x  -- | id function. Useful for type specification --