connections-0.3.2: Orders, Galois connections, and lattices.

Safe HaskellSafe
LanguageHaskell2010

Data.Connection.Fixed

Contents

Synopsis

Uni

type Uni = Fixed E0 #

resolution of 1, this works the same as Integer

Deci

type Deci = Fixed E1 #

resolution of 10^-1 = .1

Centi

type Centi = Fixed E2 #

resolution of 10^-2 = .01, useful for many monetary currencies

Milli

type Milli = Fixed E3 #

resolution of 10^-3 = .001

Micro

type Micro = Fixed E6 #

resolution of 10^-6 = .000001

Nano

type Nano = Fixed E9 #

resolution of 10^-9 = .000000001

Pico

type Pico = Fixed E12 #

resolution of 10^-12 = .000000000001

Fixed

ratfix :: forall e k. HasResolution e => Cast k Rational (Extended (Fixed e)) Source #

shiftf :: Integer -> Fixed a -> Fixed a Source #

Shift by n 'units of least precision' where the ULP is determined by the precision.

This is an analog of shift32 for fixed point numbers.

showFixed :: HasResolution a => Bool -> Fixed a -> String #

First arg is whether to chop off trailing zeros

newtype Fixed a #

The type parameter should be an instance of HasResolution.

Constructors

MkFixed Integer 
Instances
Connection k Pico Nano Source # 
Instance details

Defined in Data.Connection.Class

Methods

cast :: Cast k Pico Nano Source #

Connection k Pico Micro Source # 
Instance details

Defined in Data.Connection.Class

Methods

cast :: Cast k Pico Micro Source #

Connection k Nano Micro Source # 
Instance details

Defined in Data.Connection.Class

Methods

cast :: Cast k Nano Micro Source #

Connection k Pico Milli Source # 
Instance details

Defined in Data.Connection.Class

Methods

cast :: Cast k Pico Milli Source #

Connection k Nano Milli Source # 
Instance details

Defined in Data.Connection.Class

Methods

cast :: Cast k Nano Milli Source #

Connection k Micro Milli Source # 
Instance details

Defined in Data.Connection.Class

Methods

cast :: Cast k Micro Milli Source #

Connection k Pico Centi Source # 
Instance details

Defined in Data.Connection.Class

Methods

cast :: Cast k Pico Centi Source #

Connection k Nano Centi Source # 
Instance details

Defined in Data.Connection.Class

Methods

cast :: Cast k Nano Centi Source #

Connection k Micro Centi Source # 
Instance details

Defined in Data.Connection.Class

Methods

cast :: Cast k Micro Centi Source #

Connection k Milli Centi Source # 
Instance details

Defined in Data.Connection.Class

Methods

cast :: Cast k Milli Centi Source #

Connection k Pico Deci Source # 
Instance details

Defined in Data.Connection.Class

Methods

cast :: Cast k Pico Deci Source #

Connection k Nano Deci Source # 
Instance details

Defined in Data.Connection.Class

Methods

cast :: Cast k Nano Deci Source #

Connection k Micro Deci Source # 
Instance details

Defined in Data.Connection.Class

Methods

cast :: Cast k Micro Deci Source #

Connection k Milli Deci Source # 
Instance details

Defined in Data.Connection.Class

Methods

cast :: Cast k Milli Deci Source #

Connection k Centi Deci Source # 
Instance details

Defined in Data.Connection.Class

Methods

cast :: Cast k Centi Deci Source #

Connection k Pico Uni Source # 
Instance details

Defined in Data.Connection.Class

Methods

cast :: Cast k Pico Uni Source #

Connection k Nano Uni Source # 
Instance details

Defined in Data.Connection.Class

Methods

cast :: Cast k Nano Uni Source #

Connection k Micro Uni Source # 
Instance details

Defined in Data.Connection.Class

Methods

cast :: Cast k Micro Uni Source #

Connection k Milli Uni Source # 
Instance details

Defined in Data.Connection.Class

Methods

cast :: Cast k Milli Uni Source #

Connection k Centi Uni Source # 
Instance details

Defined in Data.Connection.Class

Methods

cast :: Cast k Centi Uni Source #

Connection k Deci Uni Source # 
Instance details

Defined in Data.Connection.Class

Methods

cast :: Cast k Deci Uni Source #

Connection k Uni Integer Source # 
Instance details

Defined in Data.Connection.Class

Methods

cast :: Cast k Uni Integer Source #

HasResolution res => Connection k Rational (Extended (Fixed res)) Source # 
Instance details

Defined in Data.Connection.Class

Methods

cast :: Cast k Rational (Extended (Fixed res)) Source #

HasResolution res => Connection L Double (Extended (Fixed res)) Source # 
Instance details

Defined in Data.Connection.Class

Methods

cast :: Cast L Double (Extended (Fixed res)) Source #

HasResolution res => Connection L Float (Extended (Fixed res)) Source # 
Instance details

Defined in Data.Connection.Class

Methods

cast :: Cast L Float (Extended (Fixed res)) Source #

Enum (Fixed a)

Since: base-2.1

Instance details

Defined in Data.Fixed

Methods

succ :: Fixed a -> Fixed a #

pred :: Fixed a -> Fixed a #

toEnum :: Int -> Fixed a #

fromEnum :: Fixed a -> Int #

enumFrom :: Fixed a -> [Fixed a] #

enumFromThen :: Fixed a -> Fixed a -> [Fixed a] #

enumFromTo :: Fixed a -> Fixed a -> [Fixed a] #

enumFromThenTo :: Fixed a -> Fixed a -> Fixed a -> [Fixed a] #

Eq (Fixed a)

Since: base-2.1

Instance details

Defined in Data.Fixed

Methods

(==) :: Fixed a -> Fixed a -> Bool #

(/=) :: Fixed a -> Fixed a -> Bool #

HasResolution a => Fractional (Fixed a)

Since: base-2.1

Instance details

Defined in Data.Fixed

Methods

(/) :: Fixed a -> Fixed a -> Fixed a #

recip :: Fixed a -> Fixed a #

fromRational :: Rational -> Fixed a #

Typeable a => Data (Fixed a)

Since: base-4.1.0.0

Instance details

Defined in Data.Fixed

Methods

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

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

toConstr :: Fixed a -> Constr #

dataTypeOf :: Fixed a -> DataType #

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

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

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

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

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

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

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

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

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

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

HasResolution a => Num (Fixed a)

Since: base-2.1

Instance details

Defined in Data.Fixed

Methods

(+) :: Fixed a -> Fixed a -> Fixed a #

(-) :: Fixed a -> Fixed a -> Fixed a #

(*) :: Fixed a -> Fixed a -> Fixed a #

negate :: Fixed a -> Fixed a #

abs :: Fixed a -> Fixed a #

signum :: Fixed a -> Fixed a #

fromInteger :: Integer -> Fixed a #

Ord (Fixed a)

Since: base-2.1

Instance details

Defined in Data.Fixed

Methods

compare :: Fixed a -> Fixed a -> Ordering #

(<) :: Fixed a -> Fixed a -> Bool #

(<=) :: Fixed a -> Fixed a -> Bool #

(>) :: Fixed a -> Fixed a -> Bool #

(>=) :: Fixed a -> Fixed a -> Bool #

max :: Fixed a -> Fixed a -> Fixed a #

min :: Fixed a -> Fixed a -> Fixed a #

HasResolution a => Read (Fixed a)

Since: base-4.3.0.0

Instance details

Defined in Data.Fixed

HasResolution a => Real (Fixed a)

Since: base-2.1

Instance details

Defined in Data.Fixed

Methods

toRational :: Fixed a -> Rational #

HasResolution a => RealFrac (Fixed a)

Since: base-2.1

Instance details

Defined in Data.Fixed

Methods

properFraction :: Integral b => Fixed a -> (b, Fixed a) #

truncate :: Integral b => Fixed a -> b #

round :: Integral b => Fixed a -> b #

ceiling :: Integral b => Fixed a -> b #

floor :: Integral b => Fixed a -> b #

HasResolution a => Show (Fixed a)

Since: base-2.1

Instance details

Defined in Data.Fixed

Methods

showsPrec :: Int -> Fixed a -> ShowS #

show :: Fixed a -> String #

showList :: [Fixed a] -> ShowS #

Preorder (Fixed e) Source # 
Instance details

Defined in Data.Order

Methods

(<~) :: Fixed e -> Fixed e -> Bool 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 #

plt :: Fixed e -> Fixed e -> Bool Source #

pgt :: Fixed e -> Fixed e -> Bool Source #

similar :: Fixed e -> Fixed e -> Bool Source #

pmax :: Fixed e -> Fixed e -> Maybe (Fixed e) Source #

pmin :: Fixed e -> Fixed e -> Maybe (Fixed e) Source #

pcompare :: Fixed e -> Fixed e -> Maybe Ordering Source #

class HasResolution a where #

Methods

resolution :: p a -> Integer #

Instances
HasResolution E0

Since: base-4.1.0.0

Instance details

Defined in Data.Fixed

Methods

resolution :: p E0 -> Integer #

HasResolution E1

Since: base-4.1.0.0

Instance details

Defined in Data.Fixed

Methods

resolution :: p E1 -> Integer #

HasResolution E2

Since: base-4.1.0.0

Instance details

Defined in Data.Fixed

Methods

resolution :: p E2 -> Integer #

HasResolution E3

Since: base-4.1.0.0

Instance details

Defined in Data.Fixed

Methods

resolution :: p E3 -> Integer #

HasResolution E6

Since: base-2.1

Instance details

Defined in Data.Fixed

Methods

resolution :: p E6 -> Integer #

HasResolution E9

Since: base-4.1.0.0

Instance details

Defined in Data.Fixed

Methods

resolution :: p E9 -> Integer #

HasResolution E12

Since: base-2.1

Instance details

Defined in Data.Fixed

Methods

resolution :: p E12 -> Integer #