extended-reals-0.2.4.0: Extension of real numbers with positive/negative infinities
Copyright (c) Masahiro Sakai 2014
License BSD-style
Maintainer masahiro.sakai@gmail.com
Stability provisional
Portability non-portable (DeriveDataTypeable)
Safe Haskell Safe-Inferred
Language Haskell2010

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

Instances details
Functor Extended Source #
Instance details

Defined in Data.ExtendedReal

Bounded ( Extended r) Source #
Instance details

Defined in Data.ExtendedReal

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

Defined in Data.ExtendedReal

( 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) Source #

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

toConstr :: Extended r -> Constr Source #

dataTypeOf :: Extended r -> DataType Source #

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

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

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

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

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

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

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

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

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

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

( 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

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

Defined in Data.ExtendedReal

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

Defined in Data.ExtendedReal

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

Defined in Data.ExtendedReal

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

Defined in Data.ExtendedReal

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 .