connections-0.0.3: Partial orders, Galois connections, and lattices.

Safe HaskellNone
LanguageHaskell2010

Data.Connection.Round

Contents

Synopsis

Rounding Classes

class Prd a => TripInt16 a where Source #

Instances
TripInt16 Double Source # 
Instance details

Defined in Data.Connection.Round

TripInt16 Float Source # 
Instance details

Defined in Data.Connection.Round

TripInt16 (Ratio Integer) Source # 
Instance details

Defined in Data.Connection.Round

ceil16 :: TripInt16 a => a -> a Source #

floor16 :: TripInt16 a => a -> a Source #

trunc16 :: (Additive - Monoid) a => TripInt16 a => a -> a Source #

round16 :: (Additive - Group) a => TripInt16 a => a -> a Source #

class Prd a => TripInt32 a where Source #

Instances
TripInt32 Double Source # 
Instance details

Defined in Data.Connection.Round

TripInt32 (Ratio Integer) Source # 
Instance details

Defined in Data.Connection.Round

ceil32 :: TripInt32 a => a -> a Source #

floor32 :: TripInt32 a => a -> a Source #

trunc32 :: (Additive - Monoid) a => TripInt32 a => a -> a Source #

round32 :: (Additive - Group) a => TripInt32 a => a -> a Source #

Rounding Utils

data Mode Source #

The four primary IEEE rounding modes.

See https://en.wikipedia.org/wiki/Rounding.

Constructors

RNZ

round to nearest with ties towards zero

RTP

round towards pos infinity

RTN

round towards neg infinity

RTZ

round towards zero

Instances
Eq Mode Source # 
Instance details

Defined in Data.Connection.Round

Methods

(==) :: Mode -> Mode -> Bool #

(/=) :: Mode -> Mode -> Bool #

Show Mode Source # 
Instance details

Defined in Data.Connection.Round

Methods

showsPrec :: Int -> Mode -> ShowS #

show :: Mode -> String #

showList :: [Mode] -> ShowS #

half :: Prd a => Prd b => (Additive - Group) a => Trip a b -> a -> Maybe Ordering Source #

Determine which half of the interval between two representations of a a particular value lies.

tied :: Prd a => Prd b => (Additive - Group) a => Trip a b -> a -> Bool Source #

Determine whether x lies exactly halfway between two representations.

 tied t x == (x - unitl t x) =~ (counitr t x - x)

above :: Prd a => Prd b => (Additive - Group) a => Trip a b -> a -> Bool Source #

Determine whether x lies above the halfway point between two representations.

 above t x == (x - unitl t x) 'gt' (counitr t x - x)

below :: Prd a => Prd b => (Additive - Group) a => Trip a b -> a -> Bool Source #

Determine whether x lies below the halfway point between two representations.

 below t x == (x - unitl t x) 'lt' (counitr t x - x)

addWith :: (Prd a, Prd b, (Additive - Group) a) => Trip a b -> Mode -> b -> b -> b Source #

negWith :: (Prd a, Prd b, (Additive - Group) a) => Trip a b -> Mode -> b -> b Source #

subWith :: (Prd a, Prd b, (Additive - Group) a) => Trip a b -> Mode -> b -> b -> b Source #

mulWith :: (Prd a, Prd b, Ring a) => Trip a b -> Mode -> b -> b -> b Source #

fmaWith :: (Prd a, Prd b, Ring a) => Trip a b -> Mode -> b -> b -> b -> b Source #

remWith :: (Prd a, Prd b, Field a) => Trip a b -> Mode -> b -> b -> b Source #

divWith :: (Prd a, Prd b, Field a) => Trip a b -> Mode -> b -> b -> b Source #

divWith' :: (Prd a, Prd b, Field a) => Trip a b -> Mode -> b -> b -> b Source #