definition: |
divModInteger :: BinInt -> BinInt -> (BinInt, BinInt) divModInteger _ Zero = failed -- division by zero is not defined divModInteger Zero (Pos _) = (Zero, Zero) divModInteger Zero (Neg _) = (Zero, Zero) divModInteger (Pos x) (Pos y) = quotRemNat x y divModInteger (Neg x) (Pos y) = let (d, m) = quotRemNat x y in case m of Zero -> (neg d, m) _ -> (neg (inc d), (Pos y) -# m) divModInteger (Pos x) (Neg y) = let (d, m) = quotRemNat x y in case m of Zero -> (neg d, m) _ -> (neg (inc d), m -# (Pos y)) divModInteger (Neg x) (Neg y) = let (d, m) = quotRemNat x y in (d, neg m) |
demand: |
arguments 1 2 |
deterministic: |
deterministic operation |
documentation: |
--- Quotient and Remainder, truncated against negative infinity |
failfree: |
<FAILING> |
indeterministic: |
referentially transparent operation |
infix: |
no fixity defined |
iotype: |
{({Zero},{Pos}) |-> {(,)} || ({Pos},{Pos}) |-> {(,)} || ({Neg},{Pos}) |-> _ || ({Zero},{Neg}) |-> {(,)} || ({Pos},{Neg}) |-> _ || ({Neg},{Neg}) |-> {(,)}} |
name: |
divModInteger |
precedence: |
no precedence defined |
result-values: |
{(,)} |
signature: |
BinInt -> BinInt -> (BinInt, BinInt) |
solution-complete: |
operation might suspend on free variables |
terminating: |
possibly non-terminating |
totally-defined: |
possibly non-reducible on same data term |