extended-reals-0.2.0.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-Inferred
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:

  • Wikipedia contributors, "Extended real number line," Wikipedia, The Free Encyclopedia, https:/en.wikipedia.orgwiki/Extended_real_number_line (accessed September 1, 2014).

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 
Bounded (Extended r) 
Eq r => Eq (Extended r) 
(Fractional r, Ord r) => Fractional (Extended r)

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

Data r => Data (Extended r) 
(Num r, Ord r) => Num (Extended r)

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.

Ord r => Ord (Extended r) 
Read r => Read (Extended r) 
Show r => Show (Extended r) 
NFData r => NFData (Extended r) 
Hashable r => Hashable (Extended r) 
Typeable (* -> *) Extended 

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.