divMod

simultaneous div and mod. WARNING: This function is partial (because it throws when 0 is passed as the divisor) for all the integer types in base.
simultaneous div and mod WARNING: This function is partial (because it throws when 0 is passed as the divisor) for all the integer types in base.
simultaneous div and mod
\n (QC.NonZero m) -> let (q,r) = divMod n m in n == (q*m+r :: Integer)
\x y -> case (PolyCore.normalize x, PolyCore.normalize y) of (nx, ny) -> not (null (ratioPoly ny)) ==> mapSnd PolyCore.normalize (PolyCore.divMod nx ny) == mapPair (PolyCore.normalize, PolyCore.normalize) (PolyCore.divMod x y)
\x y -> not (isZero (ratioPoly y)) ==> let z = fst $ PolyCore.divMod (Poly.coeffs x) y in  PolyCore.normalize z == z
\x y -> case PolyCore.normalize $ ratioPoly y of ny -> not (null ny) ==> List.length (snd $ PolyCore.divMod x y) < List.length ny
Simultaneous div and mod.
simultaneous div and mod
Simultaneous div and mod.
Type-level divMod
The quotient and remainder of a type-level integer and a natural number. For a negative dividend, the remainder part is positive such that x = q*y + r @since 0.1.4
Generalisation of divMod to any instance of Real
Used to implement divMod for the Integral typeclass. This gives a tuple equivalent to
(div x y, mod x y)

Example

>>> divModInt 10 2
(5,0)
>>> divMod 10 2
(5,0)
Used to implement divMod for the Integral typeclass. This gives a tuple equivalent to
(div x y, mod x y)

Example

>>> divModInteger 10 2
(5,0)
>>> divMod 10 2
(5,0)
Simultaneous divInteger and modInteger. Divisor must be non-zero otherwise the GHC runtime will terminate with a division-by-zero fault.
Allows division by zero. If the divisor is zero, then the dividend is returned as remainder.