ivory-0.1.0.3: Safe embedded C programming.

Safe HaskellNone
LanguageHaskell2010

Ivory.Language.IIntegral

Synopsis

Documentation

class (IvoryExpr a, IvoryOrd a, Num a) => IvoryIntegral a where Source

Integral, without the baggage from Haskell (i.e., supertypes of Real and Enum). Defines Euclidian division (rather than truncated division). See http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.74.8522. Notable properties, beyond the normal div/rem properties, are that

The remainder is always non-negative. For d1 < 0, d0 iDiv (-d1) == -(d0 iDiv d1). For d1 < 0, d0 .% (-d1) == d0 .% d1.

N.B. mod and rem are equal if both args are positive, and C has no mod operator (only rem). In Haskell and C, both mod and rem may return negative values. Furthermore, before C99, the result of rem is implementation-defined.

Minimal complete definition

Nothing

Methods

iDiv :: a -> a -> a Source

Euclidean division.

(.%) :: a -> a -> a Source

Euclidean remainder.

(./) :: IvoryIntegral a => a -> a -> a Source

iRem :: IvoryIntegral a => a -> a -> a Source