intervals-0.8.1: Interval Arithmetic

Copyright | (c) Edward Kmett 2010-2014
License | BSD3
Maintainer | ekmett@gmail.com
Stability | experimental
Portability | DeriveDataTypeable
Safe Haskell | Safe
Language | Haskell98

Numeric.Interval.NonEmpty.Internal

Description

Interval arithmetic

Synopsis

- data Interval a = I !a !a
- (...) :: Ord a => a -> a -> Interval a
- interval :: Ord a => a -> a -> Maybe (Interval a)
- whole :: Fractional a => Interval a
- singleton :: a -> Interval a
- member :: Ord a => a -> Interval a -> Bool
- notMember :: Ord a => a -> Interval a -> Bool
- elem :: Ord a => a -> Interval a -> Bool
- notElem :: Ord a => a -> Interval a -> Bool
- inf :: Interval a -> a
- sup :: Interval a -> a
- singular :: Ord a => Interval a -> Bool
- width :: Num a => Interval a -> a
- midpoint :: Fractional a => Interval a -> a
- distance :: (Num a, Ord a) => Interval a -> Interval a -> a
- intersection :: Ord a => Interval a -> Interval a -> Maybe (Interval a)
- hull :: Ord a => Interval a -> Interval a -> Interval a
- bisect :: Fractional a => Interval a -> (Interval a, Interval a)
- bisectIntegral :: Integral a => Interval a -> (Interval a, Interval a)
- magnitude :: (Num a, Ord a) => Interval a -> a
- mignitude :: (Num a, Ord a) => Interval a -> a
- contains :: Ord a => Interval a -> Interval a -> Bool
- isSubsetOf :: Ord a => Interval a -> Interval a -> Bool
- certainly :: Ord a => (forall b. Ord b => b -> b -> Bool) -> Interval a -> Interval a -> Bool
- (<!) :: Ord a => Interval a -> Interval a -> Bool
- (<=!) :: Ord a => Interval a -> Interval a -> Bool
- (==!) :: Eq a => Interval a -> Interval a -> Bool
- (>=!) :: Ord a => Interval a -> Interval a -> Bool
- (>!) :: Ord a => Interval a -> Interval a -> Bool
- possibly :: Ord a => (forall b. Ord b => b -> b -> Bool) -> Interval a -> Interval a -> Bool
- (<?) :: Ord a => Interval a -> Interval a -> Bool
- (<=?) :: Ord a => Interval a -> Interval a -> Bool
- (==?) :: Ord a => Interval a -> Interval a -> Bool
- (>=?) :: Ord a => Interval a -> Interval a -> Bool
- (>?) :: Ord a => Interval a -> Interval a -> Bool
- clamp :: Ord a => Interval a -> a -> a
- inflate :: (Num a, Ord a) => a -> Interval a -> Interval a
- deflate :: (Fractional a, Ord a) => a -> Interval a -> Interval a
- scale :: (Fractional a, Ord a) => a -> Interval a -> Interval a
- symmetric :: (Num a, Ord a) => a -> Interval a
- idouble :: Interval Double -> Interval Double
- ifloat :: Interval Float -> Interval Float
- iquot :: Integral a => Interval a -> Interval a -> Interval a
- irem :: Integral a => Interval a -> Interval a -> Interval a
- idiv :: Integral a => Interval a -> Interval a -> Interval a
- imod :: Integral a => Interval a -> Interval a -> Interval a

# Documentation

data Interval a Source #

Constructors

I !a !a |

Instances

Foldable Interval Source # |

Instance details

Defined in Numeric.Interval.NonEmpty.Internal

Methods

fold :: Monoid m => Interval m -> m Source #

foldMap :: Monoid m => (a -> m) -> Interval a -> m Source #

foldr :: (a -> b -> b) -> b -> Interval a -> b Source #

foldr' :: (a -> b -> b) -> b -> Interval a -> b Source #

foldl :: (b -> a -> b) -> b -> Interval a -> b Source #

foldl' :: (b -> a -> b) -> b -> Interval a -> b Source #

foldr1 :: (a -> a -> a) -> Interval a -> a Source #

foldl1 :: (a -> a -> a) -> Interval a -> a Source #

toList :: Interval a -> [a] Source #

null :: Interval a -> Bool Source #

length :: Interval a -> Int Source #

elem :: Eq a => a -> Interval a -> Bool Source #

maximum :: Ord a => Interval a -> a Source #

minimum :: Ord a => Interval a -> a Source #

sum :: Num a => Interval a -> a Source #

product :: Num a => Interval a -> a Source #

Eq a => Eq (Interval a) Source # |
Instance details Defined in Numeric.Interval.NonEmpty.Internal Methods (==) :: Interval a -> Interval a -> Bool Source # (/=) :: Interval a -> Interval a -> Bool Source #

(RealFloat a, Ord a) => Floating (Interval a) Source #

Transcendental functions for intervals.

    conservative (exp :: Double -> Double) exp

    conservativeExceptNaN (log :: Double -> Double) log

    conservative (sin :: Double -> Double) sin

    conservative (cos :: Double -> Double) cos

    conservative (tan :: Double -> Double) tan

    conservativeExceptNaN (asin :: Double -> Double) asin

    conservativeExceptNaN (acos :: Double -> Double) acos

    conservative (atan :: Double -> Double) atan

    conservative (sinh :: Double -> Double) sinh

    conservative (cosh :: Double -> Double) cosh

    conservative (tanh :: Double -> Double) tanh

    conservativeExceptNaN (asinh :: Double -> Double) asinh

    conservativeExceptNaN (acosh :: Double -> Double) acosh

    conservativeExceptNaN (atanh :: Double -> Double) atanh

    >>> cos (0 ... (pi + 0.1))
    -1.0 ... 1.0

Instance details

Defined in Numeric.Interval.NonEmpty.Internal

Methods

pi :: Interval a Source #

exp :: Interval a -> Interval a Source #

log :: Interval a -> Interval a Source #

sqrt :: Interval a -> Interval a Source #

(**) :: Interval a -> Interval a -> Interval a Source #

logBase :: Interval a -> Interval a -> Interval a Source #

sin :: Interval a -> Interval a Source #

cos :: Interval a -> Interval a Source #

tan :: Interval a -> Interval a Source #

asin :: Interval a -> Interval a Source #

acos :: Interval a -> Interval a Source #

atan :: Interval a -> Interval a Source #

sinh :: Interval a -> Interval a Source #

cosh :: Interval a -> Interval a Source #

tanh :: Interval a -> Interval a Source #

asinh :: Interval a -> Interval a Source #

acosh :: Interval a -> Interval a Source #

atanh :: Interval a -> Interval a Source #

log1p :: Interval a -> Interval a Source #

expm1 :: Interval a -> Interval a Source #

log1pexp :: Interval a -> Interval a Source #

log1mexp :: Interval a -> Interval a Source #

(Fractional a, Ord a) => Fractional (Interval a) Source #

Fractional instance for intervals.

    ys /= singleton 0 ==> conservative2 ((/) :: Double -> Double -> Double) (/) xs ys

    xs /= singleton 0 ==> conservative (recip :: Double -> Double) recip xs

Instance details Defined in Numeric.Interval.NonEmpty.Internal Methods (/) :: Interval a -> Interval a -> Interval a Source # recip :: Interval a -> Interval a Source # fromRational :: Rational -> Interval a Source #
Data a => Data (Interval a) Source # |

Instance details

Defined in Numeric.Interval.NonEmpty.Internal

Methods

gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Interval a -> c (Interval a) Source #

gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c (Interval a) Source #

toConstr :: Interval a -> Constr Source #

dataTypeOf :: Interval a -> DataType Source #

dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c (Interval a)) Source #

dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c (Interval a)) Source #

gmapT :: (forall b. Data b => b -> b) -> Interval a -> Interval a Source #

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Interval a -> r Source #

gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Interval a -> r Source #

gmapQ :: (forall d. Data d => d -> u) -> Interval a -> [u] Source #

gmapQi :: Int -> (forall d. Data d => d -> u) -> Interval a -> u Source #

gmapM :: Monad m => (forall d. Data d => d -> m d) -> Interval a -> m (Interval a) Source #

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Interval a -> m (Interval a) Source #

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Interval a -> m (Interval a) Source #

(Num a, Ord a) => Num (Interval a) Source #

Num instance for intervals.

    conservative2 ((+) :: Double -> Double -> Double) (+)

    conservative2 ((-) :: Double -> Double -> Double) (-)

    conservative2 ((*) :: Double -> Double -> Double) (*)

    conservative (abs :: Double -> Double) abs

Instance details

Defined in Numeric.Interval.NonEmpty.Internal

Methods

(+) :: Interval a -> Interval a -> Interval a Source #

(-) :: Interval a -> Interval a -> Interval a Source #

(*) :: Interval a -> Interval a -> Interval a Source #

negate :: Interval a -> Interval a Source #

abs :: Interval a -> Interval a Source #

signum :: Interval a -> Interval a Source #

fromInteger :: Integer -> Interval a Source #

Ord a => Ord (Interval a) Source # |

Instance details

Defined in Numeric.Interval.NonEmpty.Internal

Methods

compare :: Interval a -> Interval a -> Ordering Source #

(<) :: Interval a -> Interval a -> Bool Source #

(<=) :: Interval a -> Interval a -> Bool Source #

(>) :: Interval a -> Interval a -> Bool Source #

(>=) :: Interval a -> Interval a -> Bool Source #

max :: Interval a -> Interval a -> Interval a Source #

min :: Interval a -> Interval a -> Interval a Source #

Real a => Real (Interval a) Source # | `realToFrac` will use the midpoint
Instance details Defined in Numeric.Interval.NonEmpty.Internal Methods toRational :: Interval a -> Rational Source #
RealFloat a => RealFloat (Interval a) Source # | We have to play some semantic games to make these methods make sense. Most compute with the midpoint of the interval.

Instance details

Defined in Numeric.Interval.NonEmpty.Internal

Methods

floatRadix :: Interval a -> Integer Source #

floatDigits :: Interval a -> Int Source #

floatRange :: Interval a -> (Int, Int) Source #

decodeFloat :: Interval a -> (Integer, Int) Source #

encodeFloat :: Integer -> Int -> Interval a Source #

exponent :: Interval a -> Int Source #

significand :: Interval a -> Interval a Source #

scaleFloat :: Int -> Interval a -> Interval a Source #

isNaN :: Interval a -> Bool Source #

isInfinite :: Interval a -> Bool Source #

isDenormalized :: Interval a -> Bool Source #

isNegativeZero :: Interval a -> Bool Source #

isIEEE :: Interval a -> Bool Source #

atan2 :: Interval a -> Interval a -> Interval a Source #

RealFrac a => RealFrac (Interval a) Source # |
Instance details Defined in Numeric.Interval.NonEmpty.Internal Methods properFraction :: Integral b => Interval a -> (b, Interval a) Source # truncate :: Integral b => Interval a -> b Source # round :: Integral b => Interval a -> b Source # ceiling :: Integral b => Interval a -> b Source # floor :: Integral b => Interval a -> b Source #
Show a => Show (Interval a) Source # |
Instance details Defined in Numeric.Interval.NonEmpty.Internal Methods showsPrec :: Int -> Interval a -> ShowS Source # show :: Interval a -> String Source # showList :: [Interval a] -> ShowS Source #
Generic (Interval a) Source # |
Instance details Defined in Numeric.Interval.NonEmpty.Internal Associated Types type Rep (Interval a) :: Type -> Type Source # Methods from :: Interval a -> Rep (Interval a) x Source # to :: Rep (Interval a) x -> Interval a Source #
Generic1 Interval Source # |
Instance details Defined in Numeric.Interval.NonEmpty.Internal Associated Types type Rep1 Interval :: k -> Type Source # Methods from1 :: Interval a -> Rep1 Interval a Source # to1 :: Rep1 Interval a -> Interval a Source #
type Rep (Interval a) Source # |

Instance details

Defined in Numeric.Interval.NonEmpty.Internal

type Rep (Interval a) = D1 (MetaData "Interval" "Numeric.Interval.NonEmpty.Internal" "intervals-0.8.1-HGgBEzGOGkM7qE7GCX7B85" False) (C1 (MetaCons "I" PrefixI False) (S1 (MetaSel (Nothing :: Maybe Symbol) NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 a) :*: S1 (MetaSel (Nothing :: Maybe Symbol) NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 a)))

type Rep1 Interval Source # |

Instance details

Defined in Numeric.Interval.NonEmpty.Internal

type Rep1 Interval = D1 (MetaData "Interval" "Numeric.Interval.NonEmpty.Internal" "intervals-0.8.1-HGgBEzGOGkM7qE7GCX7B85" False) (C1 (MetaCons "I" PrefixI False) (S1 (MetaSel (Nothing :: Maybe Symbol) NoSourceUnpackedness SourceStrict DecidedStrict) Par1 :*: S1 (MetaSel (Nothing :: Maybe Symbol) NoSourceUnpackedness SourceStrict DecidedStrict) Par1))

(...) :: Ord a => a -> a -> Interval a infix 3 Source #

Create a non-empty interval, turning it around if necessary

interval :: Ord a => a -> a -> Maybe (Interval a) Source #

Try to create a non-empty interval.

whole :: Fractional a => Interval a Source #

The whole real number line

    >>> whole
    -Infinity ... Infinity

    (x :: Double) `elem` whole

singleton :: a -> Interval a Source #

A singleton point

    >>> singleton 1
    1 ... 1

    x `elem` (singleton x)

    x /= y ==> y `notElem` (singleton x)

member :: Ord a => a -> Interval a -> Bool Source #

Determine if a point is in the interval.

    >>> member 3.2 (1.0 ... 5.0)
    True

    >>> member 5 (1.0 ... 5.0)
    True

    >>> member 1 (1.0 ... 5.0)
    True

    >>> member 8 (1.0 ... 5.0)
    False

notMember :: Ord a => a -> Interval a -> Bool Source #

Determine if a point is not included in the interval

    >>> notMember 8 (1.0 ... 5.0)
    True

    >>> notMember 1.4 (1.0 ... 5.0)
    False

elem :: Ord a => a -> Interval a -> Bool Source #

Deprecated: Use `member` instead.

Determine if a point is in the interval.

    >>> elem 3.2 (1.0 ... 5.0)
    True

    >>> elem 5 (1.0 ... 5.0)
    True

    >>> elem 1 (1.0 ... 5.0)
    True

    >>> elem 8 (1.0 ... 5.0)
    False

notElem :: Ord a => a -> Interval a -> Bool Source #

Deprecated: Use `notMember` instead.

Determine if a point is not included in the interval

    >>> notElem 8 (1.0 ... 5.0)
    True

    >>> notElem 1.4 (1.0 ... 5.0)
    False

inf :: Interval a -> a Source #

The infinumum (lower bound) of an interval

    >>> inf (1 ... 20)
    1

    min x y == inf (x ... y)

    inf x <= sup x

sup :: Interval a -> a Source #

The supremum (upper bound) of an interval

    >>> sup (1 ... 20)
    20

    sup x `elem` x

    max x y == sup (x ... y)

    inf x <= sup x

singular :: Ord a => Interval a -> Bool Source #

Is the interval a singleton point? N.B. This is fairly fragile and likely will not hold after even a few operations that only involve singletons

    >>> singular (singleton 1)
    True

    >>> singular (1.0 ... 20.0)
    False

width :: Num a => Interval a -> a Source #

Calculate the width of an interval.

    >>> width (1 ... 20)
    19

    >>> width (singleton 1)
    0

    0 <= width x

midpoint :: Fractional a => Interval a -> a Source #

Nearest point to the midpoint of the interval.

    >>> midpoint (10.0 ... 20.0)
    15.0

    >>> midpoint (singleton 5.0)
    5.0

    midpoint x `elem` (x :: Interval Double)

distance :: (Num a, Ord a) => Interval a -> Interval a -> a Source #

Hausdorff distance between intervals.

    >>> distance (1 ... 7) (6 ... 10)
    0

    >>> distance (1 ... 7) (15 ... 24)
    8

    >>> distance (1 ... 7) (-10 ... -2)
    3

    commutative (distance :: Interval Double -> Interval Double -> Double)

    0 <= distance x y

intersection :: Ord a => Interval a -> Interval a -> Maybe (Interval a) Source #

Calculate the intersection of two intervals.

    >>> intersection (1 ... 10 :: Interval Double) (5 ... 15 :: Interval Double)
    Just (5.0 ... 10.0)

hull :: Ord a => Interval a -> Interval a -> Interval a Source #

Calculate the convex hull of two intervals

    >>> hull (0 ... 10 :: Interval Double) (5 ... 15 :: Interval Double)
    0.0 ... 15.0

    >>> hull (15 ... 85 :: Interval Double) (0 ... 10 :: Interval Double)
    0.0 ... 85.0

    conservative2 const hull

    conservative2 (flip const) hull

bisect :: Fractional a => Interval a -> (Interval a, Interval a) Source #

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

bisectIntegral :: Integral a => Interval a -> (Interval a, Interval a) Source #

magnitude :: (Num a, Ord a) => Interval a -> a Source #

Magnitude

    >>> magnitude (1 ... 20)
    20

    >>> magnitude (-20 ... 10)
    20

    >>> magnitude (singleton 5)
    5

    0 <= magnitude x

mignitude :: (Num a, Ord a) => Interval a -> a Source #

"mignitude"

    >>> mignitude (1 ... 20)
    1

    >>> mignitude (-20 ... 10)
    0

    >>> mignitude (singleton 5)
    5

    0 <= mignitude x

contains :: Ord a => Interval a -> Interval a -> Bool Source #

Check if interval `X` totally contains interval `Y`

    >>> (20 ... 40 :: Interval Double) `contains` (25 ... 35 :: Interval Double)
    True

    >>> (20 ... 40 :: Interval Double) `contains` (15 ... 35 :: Interval Double)
    False

isSubsetOf :: Ord a => Interval a -> Interval a -> Bool Source #

Flipped version of `contains`. Check if interval `X` a subset of interval `Y`

    >>> (25 ... 35 :: Interval Double) `isSubsetOf` (20 ... 40 :: Interval Double)
    True

    >>> (20 ... 40 :: Interval Double) `isSubsetOf` (15 ... 35 :: Interval Double)
    False

certainly :: Ord a => (forall b. Ord b => b -> b -> Bool) -> Interval a -> Interval a -> Bool Source #

For all `x` in `X`, `y` in `Y`. `x `op` y`

(<!) :: Ord a => Interval a -> Interval a -> Bool Source #

For 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

(<=!) :: Ord a => Interval a -> Interval a -> Bool Source #

For 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

(==!) :: Eq a => Interval a -> Interval a -> Bool Source #

For all `x` in `X`, `y` in `Y`. `x `==` y`

Only singleton intervals or empty intervals can return true

    >>> (singleton 5 :: Interval Double) ==! (singleton 5 :: Interval Double)
    True

    >>> (5 ... 10 :: Interval Double) ==! (5 ... 10 :: Interval Double)
    False

(>=!) :: Ord a => Interval a -> Interval a -> Bool Source #

For all `x` in `X`, `y` in `Y`. `x `>=` y`

    >>> (20 ... 40 :: Interval Double) >=! (10 ... 20 :: Interval Double)
    True

    >>> (5 ... 20 :: Interval Double) >=! (15 ... 40 :: Interval Double)
    False

(>!) :: Ord a => Interval a -> Interval a -> Bool Source #

For 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

possibly :: Ord a => (forall b. Ord b => b -> b -> Bool) -> Interval a -> Interval a -> Bool Source #

Does there exist an `x` in `X`, `y` in `Y` such that `x `op` y`?

(<?) :: Ord a => Interval a -> Interval a -> Bool Source #

Does there exist an `x` in `X`, `y` in `Y` such that `x `<` y`?

(<=?) :: Ord a => Interval a -> Interval a -> Bool Source #

Does there exist an `x` in `X`, `y` in `Y` such that `x `<=` y`?

(==?) :: Ord a => Interval a -> Interval a -> Bool Source #

Does there exist an `x` in `X`, `y` in `Y` such that `x `==` y`?

(>=?) :: Ord a => Interval a -> Interval a -> Bool Source #

Does there exist an `x` in `X`, `y` in `Y` such that `x `>=` y`?

(>?) :: Ord a => Interval a -> Interval a -> Bool Source #

Does there exist an `x` in `X`, `y` in `Y` such that `x `>` y`?

clamp :: Ord a => Interval a -> a -> a Source #

The nearest value to that supplied which is contained in the interval.

    (clamp xs y) `elem` xs

inflate :: (Num a, Ord a) => a -> Interval a -> Interval a Source #

Inflate an interval by enlarging it at both ends.

    >>> inflate 3 (-1 ... 7)
    -4 ... 10

    >>> inflate (-2) (0 ... 4)
    -2 ... 6

    inflate x i `contains` i

deflate :: (Fractional a, Ord a) => a -> Interval a -> Interval a Source #

Deflate 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.0

    >>> deflate 2.0 (-1.0 ... 1.0)
    0.0 ... 0.0

scale :: (Fractional a, Ord a) => a -> Interval a -> Interval a Source #

Scale an interval about its midpoint.

    >>> scale 1.1 (-6.0 ... 4.0)
    -6.5 ... 4.5

    >>> scale (-2.0) (-1.0 ... 1.0)
    -2.0 ... 2.0

    abs x >= 1 ==> (scale (x :: Double) i) `contains` i

    forAll (choose (0,1)) $ \x -> abs x <= 1 ==> i `contains` (scale (x :: Double) i)

symmetric :: (Num a, Ord a) => a -> Interval a Source #

Construct a symmetric interval.

    >>> symmetric 3
    -3 ... 3

    >>> symmetric (-2)
    -2 ... 2

    x `elem` symmetric x

    0 `elem` symmetric x

idouble :: Interval Double -> Interval Double Source #

id function. Useful for type specification

    >>> :t idouble (1 ... 3)
    idouble (1 ... 3) :: Interval Double

ifloat :: Interval Float -> Interval Float Source #

id function. Useful for type specification

    >>> :t ifloat (1 ... 3)
    ifloat (1 ... 3) :: Interval Float

iquot :: Integral a => Interval a -> Interval a -> Interval a Source #

an interval containing all x `quot` y prop> forAll (memberOf xs) $ x -> forAll (memberOf ys) $ y -> 0 `notMember` ys ==> (x `quot` y) `member` (xs `iquot` ys) prop> 0 `member` ys ==> ioProperty $ do z <- try (evaluate (xs `iquot` ys)); return $ z === Left DivideByZero

irem :: Integral a => Interval a -> Interval a -> Interval a Source #

an interval containing all x `rem` y prop> forAll (memberOf xs) $ x -> forAll (memberOf ys) $ y -> 0 `notMember` ys ==> (x `rem` y) `member` (xs `irem` ys) prop> 0 `member` ys ==> ioProperty $ do z <- try (evaluate (xs `irem` ys)); return $ z === Left DivideByZero

idiv :: Integral a => Interval a -> Interval a -> Interval a Source #

an interval containing all x `div` y prop> forAll (memberOf xs) $ x -> forAll (memberOf ys) $ y -> 0 `notMember` ys ==> (x `div` y) `member` (xs `idiv` ys) prop> 0 `member` ys ==> ioProperty $ do z <- try (evaluate (xs `idiv` ys)); return $ z === Left DivideByZero

imod :: Integral a => Interval a -> Interval a -> Interval a Source #

an interval containing all x `mod` y prop> forAll (memberOf xs) $ x -> forAll (memberOf ys) $ y -> 0 `notMember` ys ==> (x `mod` y) `member` (xs `imod` ys) prop> 0 `member` ys ==> ioProperty $ do z <- try (evaluate (xs `imod` ys)); return $ z === Left DivideByZero