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

Safe HaskellNone
LanguageHaskell2010

Data.Connection.Round

Synopsis

Documentation

data Mode Source #

The four primary IEEE rounding modes.

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

Constructors

RNZ

round to nearest with ties towards 0

RTP

round towards pos infinity

RTN

round towards neg infinity

RTZ

round towards 0

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 => Num 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 => Num 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 => Num 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 => Num 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)

ceilingOn :: Prd a => Prd b => Trip a b -> a -> b Source #

floorOn :: Prd a => Prd b => Trip a b -> a -> b Source #

roundOn :: (Prd a, Prd b, Num a) => Trip a b -> a -> b Source #

truncOn :: (Prd a, Prd b, Num a) => Trip a b -> a -> b Source #

addOn :: (Prd a, Prd b, Num a) => Trip a b -> Mode -> b -> b -> b Source #

negOn :: (Prd a, Prd b, Num a) => Trip a b -> Mode -> b -> b Source #

subOn :: (Prd a, Prd b, Num a) => Trip a b -> Mode -> b -> b -> b Source #

mulOn :: (Prd a, Prd b, Num a) => Trip a b -> Mode -> b -> b -> b Source #

fmaOn :: (Prd a, Prd b, Num a) => Trip a b -> Mode -> b -> b -> b -> b Source #

remOn :: (Prd a, Prd b, Fractional a) => Trip a b -> Mode -> b -> b -> b Source #

divOn :: (Prd a, Prd b, Fractional a) => Trip a b -> Mode -> b -> b -> b Source #

divOn' :: (Prd a, Prd b, Fractional a) => Trip a b -> Mode -> b -> b -> b Source #