Dr Mark H Phillips wrote:
>Hi,
>
>Does Haskell specify how div and mod should behave when
>given one or both arguments negative?
>
Yes, section 6.4.2 gives an exact definition.
>P.S. I notice in hugs if I type "-1 `div` 3" the `div`
>binds to the 1 and 3 first, and only applies the "-"
>at the
> Does Haskell specify how div and mod should behave when
> given one or both arguments negative?
>
> Eg, in hugs we get:
>
> div 13 = 0
> div (-1) 3 = -1
> div 1 (-3) = -1
> div (-1) (-3) = 0
>
> and so on.
We usually describe div as the version of division that "truncates
toward