Copyright  (C) 20132016 University of Twente 

License  BSD2 (see the file LICENSE) 
Maintainer  Christiaan Baaij <christiaan.baaij@gmail.com> 
Safe Haskell  Safe 
Language  Haskell2010 
Extensions 

 class ExtendingNum a b where
 data SaturationMode
 class (Bounded a, Num a) => SaturatingNum a where
 boundedPlus :: SaturatingNum a => a > a > a
 boundedMin :: SaturatingNum a => a > a > a
 boundedMult :: SaturatingNum a => a > a > a
Arithmetic functions for arguments and results of different precision
class ExtendingNum a b where Source #
Adding, subtracting, and multiplying values of two different (sub)types.
Type of the result of the addition or subtraction
Type of the result of the multiplication
plus :: a > b > AResult a b Source #
Add values of different (sub)types, return a value of a (sub)type that is potentially different from either argument.
minus :: a > b > AResult a b Source #
Subtract values of different (sub)types, return a value of a (sub)type that is potentially different from either argument.
times :: a > b > MResult a b Source #
Multiply values of different (sub)types, return a value of a (sub)type that is potentially different from either argument.
ExtendingNum (Index m) (Index n) Source #  
(KnownNat m, KnownNat n) => ExtendingNum (BitVector m) (BitVector n) Source #  
ExtendingNum (Signed m) (Signed n) Source #  
(KnownNat m, KnownNat n) => ExtendingNum (Unsigned m) (Unsigned n) Source #  
ENumFixedC rep int1 frac1 int2 frac2 => ExtendingNum (Fixed rep int1 frac1) (Fixed rep int2 frac2) Source #  When used in a polymorphic setting, use the following Constraint synonyms for less verbose type signatures:

Saturating arithmetic functions
data SaturationMode Source #
Determine how overflow and underflow are handled by the functions in
SaturatingNum
class (Bounded a, Num a) => SaturatingNum a where Source #
Num
operators in which overflow and underflow behaviour can be specified
using SaturationMode
.
satPlus :: SaturationMode > a > a > a Source #
Addition with parametrisable over and underflow behaviour
satMin :: SaturationMode > a > a > a Source #
Subtraction with parametrisable over and underflow behaviour
satMult :: SaturationMode > a > a > a Source #
Multiplication with parametrisable over and underflow behaviour
(KnownNat n, (<=) 1 (* n 2), (<=) (* n 2) ((^) n 2)) => SaturatingNum (Index n) Source #  
KnownNat n => SaturatingNum (BitVector n) Source #  
KnownNat n => SaturatingNum (Signed n) Source #  
KnownNat n => SaturatingNum (Unsigned n) Source #  
NumFixedC rep int frac => SaturatingNum (Fixed rep int frac) Source #  
boundedPlus :: SaturatingNum a => a > a > a Source #
boundedMin :: SaturatingNum a => a > a > a Source #
boundedMult :: SaturatingNum a => a > a > a Source #