!Su       !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~Safe2 (c) Edward Kmett 2010-2013BSD3ekmett@gmail.com experimentalDeriveDataTypeableSafe27SXv1 intervalsThe whole real number linewhole-Infinity ... Infinity intervalsAn empty intervalemptyEmpty intervalsCheck if an interval is emptynull (1 ... 5)Falsenull (1 ... 1)False null emptyTrue intervalsA singleton point singleton 11 ... 1 intervals(The infimum (lower bound) of an intervalinf (1.0 ... 20.0)1.0 inf empty*** Exception: empty interval intervals)The supremum (upper bound) of an intervalsup (1.0 ... 20.0)20.0 sup empty*** Exception: empty interval intervalsIs the interval a singleton point? N.B. This is fairly fragile and likely will not hold after even a few operations that only involve singletonssingular (singleton 1)Truesingular (1.0 ... 20.0)False intervals#Calculate the width of an interval.width (1 ... 20)19width (singleton 1)0 width empty0 intervals Magnitudemagnitude (1 ... 20)20magnitude (-20 ... 10)20magnitude (singleton 5)5throws  if the interval is empty.magnitude empty*** Exception: empty interval intervals "mignitude"mignitude (1 ... 20)1mignitude (-20 ... 10)0mignitude (singleton 5)5throws  if the interval is empty.mignitude empty*** Exception: empty interval intervals%Hausdorff distance between intervals.distance (1 ... 7) (6 ... 10)0distance (1 ... 7) (15 ... 24)8distance (1 ... 7) (-10 ... -2)3distance Empty (1 ... 1)*** Exception: empty interval intervals1Inflate an interval by enlarging it at both ends.inflate 3 (-1 ... 7) -4 ... 10inflate (-2) (0 ... 4)-2 ... 6inflate 1 emptyEmpty  intervals3Deflate an interval by shrinking it from both ends.deflate 3.0 (-4.0 ... 10.0) -1.0 ... 7.0deflate 2.0 (-1.0 ... 1.0)Emptydeflate 1.0 emptyEmpty! intervals%Scale an interval about its midpoint.scale 1.1 (-6.0 ... 4.0) -6.5 ... 4.5scale (-2.0) (-1.0 ... 1.0)Emptyscale 3.0 emptyEmpty" intervalsConstruct a symmetric interval. symmetric 3-3 ... 3symmetric (-2)-2 ... 2# intervals#Bisect an interval at its midpoint.bisect (10.0 ... 20.0)(10.0 ... 15.0,15.0 ... 20.0)bisect (singleton 5.0)(5.0 ... 5.0,5.0 ... 5.0) bisect Empty (Empty,Empty)% intervals.Nearest point to the midpoint of the interval.midpoint (10.0 ... 20.0)15.0midpoint (singleton 5.0)5.0midpoint empty*** Exception: empty interval& intervals(Determine if a point is in the interval.member 3.2 (1.0 ... 5.0)Truemember 5 (1.0 ... 5.0)Truemember 1 (1.0 ... 5.0)Truemember 8 (1.0 ... 5.0)Falsemember 5 emptyFalse' intervals4Determine if a point is not included in the intervalnotMember 8 (1.0 ... 5.0)TruenotMember 1.4 (1.0 ... 5.0)False9And of course, nothing is a member of the empty interval.notMember 5 emptyTrue( intervals(Determine if a point is in the interval.elem 3.2 (1.0 ... 5.0)Trueelem 5 (1.0 ... 5.0)Trueelem 1 (1.0 ... 5.0)Trueelem 8 (1.0 ... 5.0)False elem 5 emptyFalse) intervals4Determine if a point is not included in the intervalnotElem 8 (1.0 ... 5.0)TruenotElem 1.4 (1.0 ... 5.0)False9And of course, nothing is a member of the empty interval.notElem 5 emptyTrue intervals9lift a monotone increasing function over a given interval intervals9lift a monotone decreasing function over a given interval* intervals,Calculate the intersection of two intervals.Hintersection (1 ... 10 :: Interval Double) (5 ... 15 :: Interval Double) 5.0 ... 10.0+ intervals*Calculate the convex hull of two intervals@hull (0 ... 10 :: Interval Double) (5 ... 15 :: Interval Double) 0.0 ... 15.0Ahull (15 ... 85 :: Interval Double) (0 ... 10 :: Interval Double) 0.0 ... 85.0, intervalsFor all x in X, y in Y. x  y?(5 ... 10 :: Interval Double) <! (20 ... 30 :: Interval Double)True?(5 ... 10 :: Interval Double) <! (10 ... 30 :: Interval Double)False?(20 ... 30 :: Interval Double) <! (5 ... 10 :: Interval Double)False- intervalsFor all x in X, y in Y. x  y@(5 ... 10 :: Interval Double) <=! (20 ... 30 :: Interval Double)True@(5 ... 10 :: Interval Double) <=! (10 ... 30 :: Interval Double)True@(20 ... 30 :: Interval Double) <=! (5 ... 10 :: Interval Double)False. intervalsFor all x in X, y in Y. x  y;Only singleton intervals or empty intervals can return trueE(singleton 5 :: Interval Double) ==! (singleton 5 :: Interval Double)True?(5 ... 10 :: Interval Double) ==! (5 ... 10 :: Interval Double)False intervalsFor all x in X, y in Y. x  y@(5 ... 15 :: Interval Double) /=! (20 ... 40 :: Interval Double)True@(5 ... 15 :: Interval Double) /=! (15 ... 40 :: Interval Double)False/ intervalsFor all x in X, y in Y. x  y@(20 ... 40 :: Interval Double) >! (10 ... 19 :: Interval Double)True?(5 ... 20 :: Interval Double) >! (15 ... 40 :: Interval Double)False0 intervalsFor all x in X, y in Y. x  yA(20 ... 40 :: Interval Double) >=! (10 ... 20 :: Interval Double)True@(5 ... 20 :: Interval Double) >=! (15 ... 40 :: Interval Double)False1 intervalsFor all x in X, y in Y. x op y2 intervalsCheck if interval X totally contains interval YH(20 ... 40 :: Interval Double) `contains` (25 ... 35 :: Interval Double)TrueH(20 ... 40 :: Interval Double) `contains` (15 ... 35 :: Interval Double)False3 intervalsFlipped version of 2. Check if interval X a subset of interval YJ(25 ... 35 :: Interval Double) `isSubsetOf` (20 ... 40 :: Interval Double)TrueJ(20 ... 40 :: Interval Double) `isSubsetOf` (15 ... 35 :: Interval Double)False4 intervalsDoes there exist an x in X, y in Y such that x  y?5 intervalsDoes there exist an x in X, y in Y such that x  y?6 intervalsDoes there exist an x in X, y in Y such that x  y? intervalsDoes there exist an x in X, y in Y such that x  y?7 intervalsDoes there exist an x in X, y in Y such that x  y?8 intervalsDoes there exist an x in X, y in Y such that x  y?9 intervalsDoes there exist an x in X, y in Y such that x op y?: intervals*id function. Useful for type specification:t idouble (1 ... 3)$idouble (1 ... 3) :: Interval Double; intervals*id function. Useful for type specification:t ifloat (1 ... 3)"ifloat (1 ... 3) :: Interval Float< intervalsan interval containing all x  y >>> (5  3) & ((4...6) < (2...4)) True >>> (1...10) <* ((-5)...4) *** Exception: divide by zero= intervalsan interval containing all x  y >>> (5  3) & ((4...6) = (2...4)) True >>> (1...10) =* ((-5)...4) *** Exception: divide by zero> intervalsan interval containing all x  y >>> (5  3) & ((4...6) > (2...4)) True >>> (1...10) >* ((-5)...4) *** Exception: divide by zero? intervalsan interval containing all x  y >>> (5  3) & ((4...6) ? (2...4)) True >>> (1...10) ?* ((-5)...4) *** Exception: divide by zero@ intervalsvWe have to play some semantic games to make these methods make sense. Most compute with the midpoint of the interval.D intervals will use the midpoint2 !"#$%&'()*+,-./0123456789:;<=>?2&'()%*+#$ !"231,-.0/945687:;<=>?63(c) Edward Kmett 2010-2014BSD3ekmett@gmail.com experimentalDeriveDataTypeableSafey0 !"#$%&'()*+,-./0123456789:;<=>?0&'()%*+#$ !"231,-.0/945687:;<=>?(c) Edward Kmett 2010-2014BSD3ekmett@gmail.com experimentalDeriveDataTypeableSafe27SX4N intervalsCreate a directed interval.O intervals#Try to create a non-empty interval.P intervalsThe whole real number linewhole-Infinity ... InfinityQ intervalsAn empty intervalempty NaN ... NaNR intervalsnegation handles NaN properlynull (1 ... 5)Falsenull (1 ... 1)False null emptyTrueS intervalsA singleton point singleton 11 ... 1T intervals*The infinumum (lower bound) of an intervalinf (1 ... 20)1U intervals)The supremum (upper bound) of an intervalsup (1 ... 20)20V intervalsIs the interval a singleton point? N.B. This is fairly fragile and likely will not hold after even a few operations that only involve singletonssingular (singleton 1)Truesingular (1.0 ... 20.0)FalseW intervals#Calculate the width of an interval.width (1 ... 20)19width (singleton 1)0 width emptyNaNX intervals Magnitudemagnitude (1 ... 20)20magnitude (-20 ... 10)20magnitude (singleton 5)5Y intervals "mignitude"mignitude (1 ... 20)1mignitude (-20 ... 10)0mignitude (singleton 5)5mignitude emptyNaNZ intervals/Hausdorff distance between non-empty intervals.distance (1 ... 7) (6 ... 10)0distance (1 ... 7) (15 ... 24)8distance (1 ... 7) (-10 ... -2)3distance empty (1 ... 1)NaN[ intervals1Inflate an interval by enlarging it at both ends.inflate 3 (-1 ... 7) -4 ... 10inflate (-2) (0 ... 4)2 ... 2\ intervals3Deflate an interval by shrinking it from both ends.deflate 3.0 (-4.0 ... 10.0) -1.0 ... 7.0deflate 2.0 (-1.0 ... 1.0) 1.0 ... -1.0] intervals%Scale an interval about its midpoint.scale 1.1 (-6.0 ... 4.0) -6.5 ... 4.5scale (-2.0) (-1.0 ... 1.0) 2.0 ... -2.0^ intervalsConstruct a symmetric interval. symmetric 3-3 ... 3symmetric (-2)2 ... -2_ intervals#Bisect an interval at its midpoint.bisect (10.0 ... 20.0)(10.0 ... 15.0,15.0 ... 20.0)bisect (singleton 5.0)(5.0 ... 5.0,5.0 ... 5.0) bisect empty(NaN ... NaN,NaN ... NaN)` intervals.Nearest point to the midpoint of the interval.midpoint (10.0 ... 20.0)15.0midpoint (singleton 5.0)5.0midpoint emptyNaNa intervals(Determine if a point is in the interval.member 3.2 (1.0 ... 5.0)Truemember 5 (1.0 ... 5.0)Truemember 1 (1.0 ... 5.0)Truemember 8 (1.0 ... 5.0)Falsemember 5 emptyFalseb intervals4Determine if a point is not included in the intervalnotMember 8 (1.0 ... 5.0)TruenotMember 1.4 (1.0 ... 5.0)False9And of course, nothing is a member of the empty interval.notMember 5 emptyTruec intervals(Determine if a point is in the interval.elem 3.2 (1.0 ... 5.0)Trueelem 5 (1.0 ... 5.0)Trueelem 1 (1.0 ... 5.0)Trueelem 8 (1.0 ... 5.0)False elem 5 emptyFalsed intervals4Determine if a point is not included in the intervalnotElem 8 (1.0 ... 5.0)TruenotElem 1.4 (1.0 ... 5.0)False9And of course, nothing is a member of the empty interval.notElem 5 emptyTrue intervals9lift a monotone increasing function over a given interval intervals9lift a monotone decreasing function over a given intervale intervals,Calculate the intersection of two intervals.Hintersection (1 ... 10 :: Interval Double) (5 ... 15 :: Interval Double) 5.0 ... 10.0f intervals*Calculate the convex hull of two intervals@hull (0 ... 10 :: Interval Double) (5 ... 15 :: Interval Double) 0.0 ... 15.0Ahull (15 ... 85 :: Interval Double) (0 ... 10 :: Interval Double) 0.0 ... 85.0g intervalsFor all x in X, y in Y. x  y?(5 ... 10 :: Interval Double) <! (20 ... 30 :: Interval Double)True?(5 ... 10 :: Interval Double) <! (10 ... 30 :: Interval Double)False?(20 ... 30 :: Interval Double) <! (5 ... 10 :: Interval Double)Falseh intervalsFor all x in X, y in Y. x  y@(5 ... 10 :: Interval Double) <=! (20 ... 30 :: Interval Double)True@(5 ... 10 :: Interval Double) <=! (10 ... 30 :: Interval Double)True@(20 ... 30 :: Interval Double) <=! (5 ... 10 :: Interval Double)Falsei intervalsFor all x in X, y in Y. x  y$Only singleton intervals return trueE(singleton 5 :: Interval Double) ==! (singleton 5 :: Interval Double)True?(5 ... 10 :: Interval Double) ==! (5 ... 10 :: Interval Double)False intervalsFor all x in X, y in Y. x  y@(5 ... 15 :: Interval Double) /=! (20 ... 40 :: Interval Double)True@(5 ... 15 :: Interval Double) /=! (15 ... 40 :: Interval Double)Falsej intervalsFor all x in X, y in Y. x  y@(20 ... 40 :: Interval Double) >! (10 ... 19 :: Interval Double)True?(5 ... 20 :: Interval Double) >! (15 ... 40 :: Interval Double)Falsek intervalsFor all x in X, y in Y. x  yA(20 ... 40 :: Interval Double) >=! (10 ... 20 :: Interval Double)True@(5 ... 20 :: Interval Double) >=! (15 ... 40 :: Interval Double)Falsel intervalsFor all x in X, y in Y. x op ym intervalsCheck if interval X totally contains interval YH(20 ... 40 :: Interval Double) `contains` (25 ... 35 :: Interval Double)TrueH(20 ... 40 :: Interval Double) `contains` (15 ... 35 :: Interval Double)Falsen intervalsFlipped version of m. Check if interval X a subset of interval YJ(25 ... 35 :: Interval Double) `isSubsetOf` (20 ... 40 :: Interval Double)TrueJ(20 ... 40 :: Interval Double) `isSubsetOf` (15 ... 35 :: Interval Double)Falseo intervalsDoes there exist an x in X, y in Y such that x  y?p intervalsDoes there exist an x in X, y in Y such that x  y?q intervalsDoes there exist an x in X, y in Y such that x  y? intervalsDoes there exist an x in X, y in Y such that x  y?r intervalsDoes there exist an x in X, y in Y such that x  y?s intervalsDoes there exist an x in X, y in Y such that x  y?t intervalsDoes there exist an x in X, y in Y such that x op y?u intervalsFThe nearest value to that supplied which is contained in the interval.v intervals*id function. Useful for type specification:t idouble (1 ... 3)$idouble (1 ... 3) :: Interval Doublew intervals*id function. Useful for type specification:t ifloat (1 ... 3)"ifloat (1 ... 3) :: Interval Floatx intervalsan interval containing all x  y >>> (5  3) a ((4...6) x (2...4)) True >>> (1...10) x* ((-5)...4) *** Exception: divide by zeroy intervalsan interval containing all x  y >>> (5  3) a ((4...6) y (2...4)) True >>> (1...10) y* ((-5)...4) *** Exception: divide by zeroz intervalsan interval containing all x  y >>> (5  3) a ((4...6) z (2...4)) True >>> (1...10) z* ((-5)...4) *** Exception: divide by zero{ intervalsan interval containing all x  y >>> (5  3) a ((4...6) { (2...4)) True >>> (1...10) {* ((-5)...4) *** Exception: divide by zero| intervalsvWe have to play some semantic games to make these methods make sense. Most compute with the midpoint of the interval. intervals will use the midpoint0LMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{0LMNOPQRSabcdTUVW`ef_XYZ[\]^mnlghikjtopqsruvwxyz{N3(c) Edward Kmett 2010-2014BSD3ekmett@gmail.com experimentalDeriveDataTypeableSafe27SXpx5 intervals;Create a non-empty interval, turning it around if necessary intervals#Try to create a non-empty interval. intervalsThe whole real number linewhole-Infinity ... Infinity(x :: Double) `elem` whole intervalsA singleton point singleton 11 ... 1x `elem` (singleton x)$x /= y ==> y `notElem` (singleton x) intervals*The infinumum (lower bound) of an intervalinf (1 ... 20)1min x y == inf (x ... y)inf x <= sup x intervals)The supremum (upper bound) of an intervalsup (1 ... 20)20sup x `elem` xmax x y == sup (x ... y)inf x <= sup x intervalsIs the interval a singleton point? N.B. This is fairly fragile and likely will not hold after even a few operations that only involve singletonssingular (singleton 1)Truesingular (1.0 ... 20.0)False intervals#Calculate the width of an interval.width (1 ... 20)19width (singleton 1)0 0 <= width x intervals Magnitudemagnitude (1 ... 20)20magnitude (-20 ... 10)20magnitude (singleton 5)50 <= magnitude x intervals "mignitude"mignitude (1 ... 20)1mignitude (-20 ... 10)0mignitude (singleton 5)50 <= mignitude x intervals#Bisect an interval at its midpoint.bisect (10.0 ... 20.0)(10.0 ... 15.0,15.0 ... 20.0)bisect (singleton 5.0)(5.0 ... 5.0,5.0 ... 5.0)<let (a, b) = bisect (x :: Interval Double) in sup a == inf b<let (a, b) = bisect (x :: Interval Double) in inf a == inf x<let (a, b) = bisect (x :: Interval Double) in sup b == sup x intervals.Nearest point to the midpoint of the interval.midpoint (10.0 ... 20.0)15.0midpoint (singleton 5.0)5.0(midpoint x `elem` (x :: Interval Double) intervals%Hausdorff distance between intervals.distance (1 ... 7) (6 ... 10)0distance (1 ... 7) (15 ... 24)8distance (1 ... 7) (-10 ... -2)3Fcommutative (distance :: Interval Double -> Interval Double -> Double)0 <= distance x y intervals(Determine if a point is in the interval.member 3.2 (1.0 ... 5.0)Truemember 5 (1.0 ... 5.0)Truemember 1 (1.0 ... 5.0)Truemember 8 (1.0 ... 5.0)False intervals4Determine if a point is not included in the intervalnotMember 8 (1.0 ... 5.0)TruenotMember 1.4 (1.0 ... 5.0)False intervals(Determine if a point is in the interval.elem 3.2 (1.0 ... 5.0)Trueelem 5 (1.0 ... 5.0)Trueelem 1 (1.0 ... 5.0)Trueelem 8 (1.0 ... 5.0)False intervals4Determine if a point is not included in the intervalnotElem 8 (1.0 ... 5.0)TruenotElem 1.4 (1.0 ... 5.0)False intervals9lift a monotone increasing function over a given interval intervals9lift a monotone decreasing function over a given interval intervals,Calculate the intersection of two intervals.Hintersection (1 ... 10 :: Interval Double) (5 ... 15 :: Interval Double)Just (5.0 ... 10.0) intervals*Calculate the convex hull of two intervals@hull (0 ... 10 :: Interval Double) (5 ... 15 :: Interval Double) 0.0 ... 15.0Ahull (15 ... 85 :: Interval Double) (0 ... 10 :: Interval Double) 0.0 ... 85.0conservative2 const hullconservative2 (flip const) hull intervalsFor all x in X, y in Y. x  y?(5 ... 10 :: Interval Double) <! (20 ... 30 :: Interval Double)True?(5 ... 10 :: Interval Double) <! (10 ... 30 :: Interval Double)False?(20 ... 30 :: Interval Double) <! (5 ... 10 :: Interval Double)False intervalsFor all x in X, y in Y. x  y@(5 ... 10 :: Interval Double) <=! (20 ... 30 :: Interval Double)True@(5 ... 10 :: Interval Double) <=! (10 ... 30 :: Interval Double)True@(20 ... 30 :: Interval Double) <=! (5 ... 10 :: Interval Double)False intervalsFor all x in X, y in Y. x  y;Only singleton intervals or empty intervals can return trueE(singleton 5 :: Interval Double) ==! (singleton 5 :: Interval Double)True?(5 ... 10 :: Interval Double) ==! (5 ... 10 :: Interval Double)False intervalsFor all x in X, y in Y. x  y@(5 ... 15 :: Interval Double) /=! (20 ... 40 :: Interval Double)True@(5 ... 15 :: Interval Double) /=! (15 ... 40 :: Interval Double)False intervalsFor all x in X, y in Y. x  y@(20 ... 40 :: Interval Double) >! (10 ... 19 :: Interval Double)True?(5 ... 20 :: Interval Double) >! (15 ... 40 :: Interval Double)False intervalsFor all x in X, y in Y. x  yA(20 ... 40 :: Interval Double) >=! (10 ... 20 :: Interval Double)True@(5 ... 20 :: Interval Double) >=! (15 ... 40 :: Interval Double)False intervalsFor all x in X, y in Y. x op y intervalsCheck if interval X totally contains interval YH(20 ... 40 :: Interval Double) `contains` (25 ... 35 :: Interval Double)TrueH(20 ... 40 :: Interval Double) `contains` (15 ... 35 :: Interval Double)False intervalsFlipped version of . Check if interval X a subset of interval YJ(25 ... 35 :: Interval Double) `isSubsetOf` (20 ... 40 :: Interval Double)TrueJ(20 ... 40 :: Interval Double) `isSubsetOf` (15 ... 35 :: Interval Double)False intervalsDoes there exist an x in X, y in Y such that x  y? intervalsDoes there exist an x in X, y in Y such that x  y? intervalsDoes there exist an x in X, y in Y such that x  y? intervalsDoes there exist an x in X, y in Y such that x  y? intervalsDoes there exist an x in X, y in Y such that x  y? intervalsDoes there exist an x in X, y in Y such that x  y? intervalsDoes there exist an x in X, y in Y such that x op y? intervalsFThe nearest value to that supplied which is contained in the interval.(clamp xs y) `elem` xs intervals1Inflate an interval by enlarging it at both ends.inflate 3 (-1 ... 7) -4 ... 10inflate (-2) (0 ... 4)-2 ... 6inflate x i `contains` i intervalsDeflate an interval by shrinking it from both ends. Note that in cases that would result in an empty interval, the result is a singleton interval at the midpoint.deflate 3.0 (-4.0 ... 10.0) -1.0 ... 7.0deflate 2.0 (-1.0 ... 1.0) 0.0 ... 0.0 intervals%Scale an interval about its midpoint.scale 1.1 (-6.0 ... 4.0) -6.5 ... 4.5scale (-2.0) (-1.0 ... 1.0) -2.0 ... 2.03abs x >= 1 ==> (scale (x :: Double) i) `contains` iQforAll (choose (0,1)) $ \x -> abs x <= 1 ==> i `contains` (scale (x :: Double) i) intervalsConstruct a symmetric interval. symmetric 3-3 ... 3symmetric (-2)-2 ... 2x `elem` symmetric x0 `elem` symmetric x intervals*id function. Useful for type specification:t idouble (1 ... 3)$idouble (1 ... 3) :: Interval Double intervals*id function. Useful for type specification:t ifloat (1 ... 3)"ifloat (1 ... 3) :: Interval Float intervalsan interval containing all x F y prop> forAll (memberOf xs) $ x -> forAll (memberOf ys) $ y -> 0  ys ==> (x  y)  (xs  ys) prop> 0 / ys ==> ioProperty $ do z <- try (evaluate (xs ' ys)); return $ z === Left DivideByZero intervalsan interval containing all x F y prop> forAll (memberOf xs) $ x -> forAll (memberOf ys) $ y -> 0  ys ==> (x  y)  (xs  ys) prop> 0 / ys ==> ioProperty $ do z <- try (evaluate (xs ' ys)); return $ z === Left DivideByZero intervalsan interval containing all x F y prop> forAll (memberOf xs) $ x -> forAll (memberOf ys) $ y -> 0  ys ==> (x  y)  (xs  ys) prop> 0 / ys ==> ioProperty $ do z <- try (evaluate (xs ' ys)); return $ z === Left DivideByZero intervalsan interval containing all x F y prop> forAll (memberOf xs) $ x -> forAll (memberOf ys) $ y -> 0  ys ==> (x  y)  (xs  ys) prop> 0 / ys ==> ioProperty $ do z <- try (evaluate (xs ' ys)); return $ z === Left DivideByZero intervalsvWe have to play some semantic games to make these methods make sense. Most compute with the midpoint of the interval. intervals'Transcendental functions for intervals.*conservative (exp :: Double -> Double) exp3conservativeExceptNaN (log :: Double -> Double) log*conservative (sin :: Double -> Double) sin*conservative (cos :: Double -> Double) cos*conservative (tan :: Double -> Double) tan5conservativeExceptNaN (asin :: Double -> Double) asin5conservativeExceptNaN (acos :: Double -> Double) acos,conservative (atan :: Double -> Double) atan,conservative (sinh :: Double -> Double) sinh,conservative (cosh :: Double -> Double) cosh,conservative (tanh :: Double -> Double) tanh7conservativeExceptNaN (asinh :: Double -> Double) asinh7conservativeExceptNaN (acosh :: Double -> Double) acosh7conservativeExceptNaN (atanh :: Double -> Double) atanhcos (0 ... (pi + 0.1)) -1.0 ... 1.0 intervals"Fractional instance for intervals.Qys /= singleton 0 ==> conservative2 ((/) :: Double -> Double -> Double) (/) xs ysGxs /= singleton 0 ==> conservative (recip :: Double -> Double) recip xs intervals will use the midpoint intervalsNum instance for intervals.5conservative2 ((+) :: Double -> Double -> Double) (+)5conservative2 ((-) :: Double -> Double -> Double) (-)5conservative2 ((*) :: Double -> Double -> Double) (*)*conservative (abs :: Double -> Double) abs//3(c) Edward Kmett 2010-2013BSD3ekmett@gmail.com experimentalDeriveDataTypeableSafe27SXs..      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOP !"#$%&'(*+,-./0123456789:;<=>Q?@ABCDEFGHIJKRSTUVWLMNOP !"()*#+,-./0123456789:;<=>Q$%&'?@ABCDEFGHIJKLMNOPXYZ[\Z[]Z[^_Z[`Z[aZ[bcdefdegdehdeidejXY_cXY_ck$intervals-0.9-I13P888L2vnBeRENth7LskNumeric.Interval.ExceptionNumeric.IntervalNumeric.Interval.InternalNumeric.Interval.KaucherNumeric.Interval.NonEmpty"Numeric.Interval.NonEmpty.InternalAmbiguousComparison EmptyInterval$fExceptionEmptyInterval$fShowEmptyInterval$fExceptionAmbiguousComparison$fShowAmbiguousComparison$fEqEmptyInterval$fOrdEmptyInterval$fDataEmptyInterval$fEqAmbiguousComparison$fOrdAmbiguousComparison$fDataAmbiguousComparisonIntervalIEmpty+/-interval...wholeemptynull singletoninfsupsingularwidth magnitude mignitudedistanceinflatedeflatescale symmetricbisectbisectIntegralmidpointmember notMemberelemnotElem intersectionhull!>=! certainlycontains isSubsetOf?>=?possiblyidoubleifloatiquotiremidivimod$fRealFloatInterval$fFloatingInterval$fRealFracInterval$fFractionalInterval$fRealInterval $fNumInterval$fShowInterval $fEqInterval $fOrdInterval$fDataInterval$fGenericInterval$fGeneric1Intervalclamp$fDistributiveInterval$fMonadInterval$fApplicativeInterval$fTraversableInterval$fFoldableInterval$fFunctorInterval increasing decreasingghc-prim GHC.Classes<<===/=!/=>>=/=?baseGHC.Realquotremdivmod realToFrac