div package:numeric-prelude

Returns the result of the division, if divisible. Otherwise undefined.
\n (QC.NonZero m) -> let (q,r) = divMod n m in n == (q*m+r :: Integer)
Allows division by zero. If the divisor is zero, then the dividend is returned as remainder.
divUp n m is similar to div but it rounds up the quotient, such that divUp n m * m = roundUp n m.
\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
The modulus will always have one element less than the divisor. This means that the modulus will be denormalized in some cases, e.g. mod [2,1,1] [1,1,1] == [1,0] instead of [1].
Divide two series where the absolute term of the divisor is non-zero. That is, power series with leading non-zero terms are the units in the ring of power series. Knuth: Seminumerical algorithms
Divide two series also if the divisor has leading zeros.
divModLazy accesses the divisor in a lazy way. However this is only relevant if the dividend is smaller than the divisor. For large dividends the divisor will be accessed multiple times but since it is already fully evaluated it could also be strict.
This function has a strict divisor and maintains the chunk structure of the dividend at a smaller scale.
Fast division for small integral divisors, which occur for instance in summands of power series.