[Haskell-cafe] Re: default for quotRem in terms of divMod?

Henning Thielemann lemming at henning-thielemann.de
Sun Aug 12 01:24:16 EDT 2007


On Sat, 11 Aug 2007, Derek Elkins wrote:

> On Sat, 2007-08-11 at 21:10 +0200, Henning Thielemann wrote:
> > Btw. is there any application, where 'quot' and 'rem' are needed? All
> > occurrences of 'quot' and 'rem' I found in code so far were actually wrong
> > and should have been 'div' and 'mod'.
> >
> > http://www.haskell.org/haskellwiki/Things_to_avoid#Forget_about_quot_and_rem
>
> quotRem is faster than divMod,

Seems that CPU design should be changed.

> and my understanding is that even divMod is arguably broken.

In what way? I can't deduce it from your reference. Quote:
 "Boute argues that Euclidean division is superior to the other ones in
terms of regularity and useful mathematical properties, although floored
division, promoted by Knuth, is also a good definition. Despite its
widespread use, truncated division is shown to be inferior to the other
definitions."

> http://www.cs.uu.nl/~daan/download/papers/divmodnote-letter.pdf

Thanks for the reference!


More information about the Haskell-Cafe mailing list