extended-reals-0.2.4.0: Extension of real numbers with positive/negative infinities

Copyright(c) Masahiro Sakai 2014
LicenseBSD-style
Maintainermasahiro.sakai@gmail.com
Stabilityprovisional
Portabilitynon-portable (DeriveDataTypeable)
Safe HaskellSafe
LanguageHaskell2010

Data.ExtendedReal

Description

Extension of real numbers with positive/negative infinities (±∞). It is useful for describing various limiting behaviors in mathematics.

Remarks:

  • ∞ - ∞ is left undefined as usual, but we define 0 × ∞ = 0 × -∞ = 0 by following the convention of probability or measure theory.

References:

Synopsis

Documentation

data Extended r Source #

Extended r is an extension of r with positive/negative infinity (±∞).

Constructors

NegInf

negative infinity (-∞)

Finite !r

finite value

PosInf

positive infinity (+∞)

Instances
Functor Extended Source # 
Instance details

Defined in Data.ExtendedReal

Methods

fmap :: (a -> b) -> Extended a -> Extended b #

(<$) :: a -> Extended b -> Extended a #

Bounded (Extended r) Source # 
Instance details

Defined in Data.ExtendedReal

Eq r => Eq (Extended r) Source # 
Instance details

Defined in Data.ExtendedReal

Methods

(==) :: Extended r -> Extended r -> Bool #

(/=) :: Extended r -> Extended r -> Bool #

(Fractional r, Ord r) => Fractional (Extended r) Source #

Note that Extended r is not a field, nor a ring.

Instance details

Defined in Data.ExtendedReal

Data r => Data (Extended r) Source # 
Instance details

Defined in Data.ExtendedReal

Methods

gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Extended r -> c (Extended r) #

gunfold :: (forall b r0. Data b => c (b -> r0) -> c r0) -> (forall r1. r1 -> c r1) -> Constr -> c (Extended r) #

toConstr :: Extended r -> Constr #

dataTypeOf :: Extended r -> DataType #

dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c (Extended r)) #

dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c (Extended r)) #

gmapT :: (forall b. Data b => b -> b) -> Extended r -> Extended r #

gmapQl :: (r0 -> r' -> r0) -> r0 -> (forall d. Data d => d -> r') -> Extended r -> r0 #

gmapQr :: (r' -> r0 -> r0) -> r0 -> (forall d. Data d => d -> r') -> Extended r -> r0 #

gmapQ :: (forall d. Data d => d -> u) -> Extended r -> [u] #

gmapQi :: Int -> (forall d. Data d => d -> u) -> Extended r -> u #

gmapM :: Monad m => (forall d. Data d => d -> m d) -> Extended r -> m (Extended r) #

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Extended r -> m (Extended r) #

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Extended r -> m (Extended r) #

(Num r, Ord r) => Num (Extended r) Source #

Note that Extended r is not a field, nor a ring.

PosInf + NegInf is left undefined as usual, but we define 0 * PosInf = 0 * NegInf = 0 by following the convention of probability or measure theory.

Instance details

Defined in Data.ExtendedReal

Ord r => Ord (Extended r) Source # 
Instance details

Defined in Data.ExtendedReal

Methods

compare :: Extended r -> Extended r -> Ordering #

(<) :: Extended r -> Extended r -> Bool #

(<=) :: Extended r -> Extended r -> Bool #

(>) :: Extended r -> Extended r -> Bool #

(>=) :: Extended r -> Extended r -> Bool #

max :: Extended r -> Extended r -> Extended r #

min :: Extended r -> Extended r -> Extended r #

Read r => Read (Extended r) Source # 
Instance details

Defined in Data.ExtendedReal

Show r => Show (Extended r) Source # 
Instance details

Defined in Data.ExtendedReal

Methods

showsPrec :: Int -> Extended r -> ShowS #

show :: Extended r -> String #

showList :: [Extended r] -> ShowS #

NFData r => NFData (Extended r) Source # 
Instance details

Defined in Data.ExtendedReal

Methods

rnf :: Extended r -> () #

Hashable r => Hashable (Extended r) Source # 
Instance details

Defined in Data.ExtendedReal

Methods

hashWithSalt :: Int -> Extended r -> Int #

hash :: Extended r -> Int #

inf :: Extended r Source #

Infinity (∞)

isFinite :: Extended r -> Bool Source #

isFinite x = not (isInfinite x).

isInfinite :: Extended r -> Bool Source #

isInfinite x returns True iff x is PosInf or NegInf.