numbers-3000.2.0.2: Various number types

Safe Haskell | None
Language | Haskell98

Data.Number.Fixed

Description

Numbers with a fixed number of decimals.

Synopsis

- data Fixed e
- class Epsilon e
- data Eps1
- data EpsDiv10 p
- data Prec10
- data Prec50
- data PrecPlus20 e
- data Prec500
- convertFixed :: (Epsilon e, Epsilon f) => Fixed e -> Fixed f
- dynamicEps :: Rational -> (forall e. Epsilon e => Fixed e -> a) -> Rational -> a
- precision :: Epsilon e => Fixed e -> Rational
- with_added_precision :: forall a f. Epsilon f => Rational -> (forall e. Epsilon e => Fixed e -> a) -> Fixed f -> a

# Documentation

data Fixed e Source #

#### Instances

Instances details

Enum (Fixed e) Source # |

Instance details

Defined in Data.Number.Fixed

Methods

succ :: Fixed e -> Fixed e Source #

pred :: Fixed e -> Fixed e Source #

toEnum :: Int -> Fixed e Source #

fromEnum :: Fixed e -> Int Source #

enumFrom :: Fixed e -> [Fixed e] Source #

enumFromThen :: Fixed e -> Fixed e -> [Fixed e] Source #

enumFromTo :: Fixed e -> Fixed e -> [Fixed e] Source #

enumFromThenTo :: Fixed e -> Fixed e -> Fixed e -> [Fixed e] Source #

Epsilon e => Floating (Fixed e) Source # |

Instance details

Defined in Data.Number.Fixed

Methods

pi :: Fixed e Source #

exp :: Fixed e -> Fixed e Source #

log :: Fixed e -> Fixed e Source #

sqrt :: Fixed e -> Fixed e Source #

(**) :: Fixed e -> Fixed e -> Fixed e Source #

logBase :: Fixed e -> Fixed e -> Fixed e Source #

sin :: Fixed e -> Fixed e Source #

cos :: Fixed e -> Fixed e Source #

tan :: Fixed e -> Fixed e Source #

asin :: Fixed e -> Fixed e Source #

acos :: Fixed e -> Fixed e Source #

atan :: Fixed e -> Fixed e Source #

sinh :: Fixed e -> Fixed e Source #

cosh :: Fixed e -> Fixed e Source #

tanh :: Fixed e -> Fixed e Source #

asinh :: Fixed e -> Fixed e Source #

acosh :: Fixed e -> Fixed e Source #

atanh :: Fixed e -> Fixed e Source #

log1p :: Fixed e -> Fixed e Source #

expm1 :: Fixed e -> Fixed e Source #

log1pexp :: Fixed e -> Fixed e Source #

log1mexp :: Fixed e -> Fixed e Source #

Epsilon e => RealFloat (Fixed e) Source # |

Instance details

Defined in Data.Number.Fixed

Methods

floatRadix :: Fixed e -> Integer Source #

floatDigits :: Fixed e -> Int Source #

floatRange :: Fixed e -> (Int, Int) Source #

decodeFloat :: Fixed e -> (Integer, Int) Source #

encodeFloat :: Integer -> Int -> Fixed e Source #

exponent :: Fixed e -> Int Source #

significand :: Fixed e -> Fixed e Source #

scaleFloat :: Int -> Fixed e -> Fixed e Source #

isNaN :: Fixed e -> Bool Source #

isInfinite :: Fixed e -> Bool Source #

isDenormalized :: Fixed e -> Bool Source #

isNegativeZero :: Fixed e -> Bool Source #

isIEEE :: Fixed e -> Bool Source #

atan2 :: Fixed e -> Fixed e -> Fixed e Source #

Epsilon e => Num (Fixed e) Source # |
Instance details Defined in Data.Number.Fixed Methods (+) :: Fixed e -> Fixed e -> Fixed e Source # (-) :: Fixed e -> Fixed e -> Fixed e Source # (*) :: Fixed e -> Fixed e -> Fixed e Source # negate :: Fixed e -> Fixed e Source # abs :: Fixed e -> Fixed e Source # signum :: Fixed e -> Fixed e Source # fromInteger :: Integer -> Fixed e Source #
Epsilon e => Read (Fixed e) Source # |
Instance details Defined in Data.Number.Fixed Methods readsPrec :: Int -> ReadS (Fixed e) Source # readList :: ReadS [Fixed e] Source # readPrec :: ReadPrec (Fixed e) Source # readListPrec :: ReadPrec [Fixed e] Source #
Epsilon e => Fractional (Fixed e) Source # |
Instance details Defined in Data.Number.Fixed Methods (/) :: Fixed e -> Fixed e -> Fixed e Source # recip :: Fixed e -> Fixed e Source # fromRational :: Rational -> Fixed e Source #
Epsilon e => Real (Fixed e) Source # |
Instance details Defined in Data.Number.Fixed Methods toRational :: Fixed e -> Rational Source #
Epsilon e => RealFrac (Fixed e) Source # |
Instance details Defined in Data.Number.Fixed Methods properFraction :: Integral b => Fixed e -> (b, Fixed e) Source # truncate :: Integral b => Fixed e -> b Source # round :: Integral b => Fixed e -> b Source # ceiling :: Integral b => Fixed e -> b Source # floor :: Integral b => Fixed e -> b Source #
Epsilon e => Show (Fixed e) Source # |
Instance details Defined in Data.Number.Fixed Methods showsPrec :: Int -> Fixed e -> ShowS Source # show :: Fixed e -> String Source # showList :: [Fixed e] -> ShowS Source #
Eq (Fixed e) Source # |
Instance details Defined in Data.Number.Fixed Methods (==) :: Fixed e -> Fixed e -> Bool Source # (/=) :: Fixed e -> Fixed e -> Bool Source #
Ord (Fixed e) Source # |
Instance details Defined in Data.Number.Fixed Methods compare :: Fixed e -> Fixed e -> Ordering Source # (<) :: Fixed e -> Fixed e -> Bool Source # (<=) :: Fixed e -> Fixed e -> Bool Source # (>) :: Fixed e -> Fixed e -> Bool Source # (>=) :: Fixed e -> Fixed e -> Bool Source # max :: Fixed e -> Fixed e -> Fixed e Source # min :: Fixed e -> Fixed e -> Fixed e Source #

class Epsilon e Source #

The `Epsilon` class contains the types that can be used to determine the precision of a `Fixed` number.

Minimal complete definition

eps

#### Instances

Instances details

Epsilon Eps1 Source # |
Instance details Defined in Data.Number.Fixed Methods eps :: Eps1 -> Rational
Epsilon Prec10 Source # |
Instance details Defined in Data.Number.Fixed Methods eps :: Prec10 -> Rational
Epsilon Prec50 Source # |
Instance details Defined in Data.Number.Fixed Methods eps :: Prec50 -> Rational
Epsilon Prec500 Source # |
Instance details Defined in Data.Number.Fixed Methods eps :: Prec500 -> Rational
Epsilon e => Epsilon (EpsDiv10 e) Source # |
Instance details Defined in Data.Number.Fixed Methods eps :: EpsDiv10 e -> Rational
Epsilon e => Epsilon (PrecPlus20 e) Source # |
Instance details Defined in Data.Number.Fixed Methods eps :: PrecPlus20 e -> Rational

data Eps1 Source #

An epsilon of 1, i.e., no decimals.

#### Instances

Instances details

Epsilon Eps1 Source # |
Instance details Defined in Data.Number.Fixed Methods eps :: Eps1 -> Rational

data EpsDiv10 p Source #

A type construct that gives one more decimals than the argument.

#### Instances

Instances details

Epsilon e => Epsilon (EpsDiv10 e) Source # |
Instance details Defined in Data.Number.Fixed Methods eps :: EpsDiv10 e -> Rational

data Prec10 Source #

Ten decimals.

#### Instances

Instances details

Epsilon Prec10 Source # |
Instance details Defined in Data.Number.Fixed Methods eps :: Prec10 -> Rational

data Prec50 Source #

50 decimals.

#### Instances

Instances details

Epsilon Prec50 Source # |
Instance details Defined in Data.Number.Fixed Methods eps :: Prec50 -> Rational

data PrecPlus20 e Source #

#### Instances

Instances details

Epsilon e => Epsilon (PrecPlus20 e) Source # |
Instance details Defined in Data.Number.Fixed Methods eps :: PrecPlus20 e -> Rational

data Prec500 Source #

500 decimals.

#### Instances

Instances details

Epsilon Prec500 Source # |
Instance details Defined in Data.Number.Fixed Methods eps :: Prec500 -> Rational

convertFixed :: (Epsilon e, Epsilon f) => Fixed e -> Fixed f Source #

Convert between two arbitrary fixed precision types.

dynamicEps :: Rational -> (forall e. Epsilon e => Fixed e -> a) -> Rational -> a Source #

precision :: Epsilon e => Fixed e -> Rational Source #

with_added_precision :: forall a f. Epsilon f => Rational -> (forall e. Epsilon e => Fixed e -> a) -> Fixed f -> a Source #

The call `with_added_precision r f v` evaluates `f v`, while temporarily multiplying the precision of v by r.