To quote section 6.4.2 from a Haskell report:
Class methods quot, rem, div, and mod satisfy these laws if y is nonzero:
(x 'quot' y)⋆y + (x 'rem' y) == x (x 'div' y)⋆y + (x 'mod' y) == x
quot is an integer division truncated to zero, and the result of a div is truncated to negative infinity.
The div function is often more natural to use, while the quot function corresponds to the machine instruction on modern machines, so it is somewhat more efficient.
augustss Nov 13 '11 at 11:27 2011-11-13 11:27
source share