Subject: Re: rem/mod ops

From: Jan Wielemaker <[email-masked]>
Date: Mon, 19 Jul 1999 11:46:24 +0200

On Sun, 18 Jul 1999, Koos Dering wrote:
>According to the supplied help-information both the rem- and the
>mod-operator produce the 'remainder of division' however while mod
>(apparently) satisfies:
>(A // B ) * B + A mod B =:= A
>so implements what is usually called the remainder of (integer) division
>rem apparenty satisfies
>(A // B + A rem B ) * B =:= A
>or (equivalently)
>A rem B =:= float_fractional_part(A/B)
>
>While this might possibly be a useful function one would expect different
>descriptions for different functions.

As far as I can tell, the implementation conforms to what one should
expect, so I adjusted the documentation:

------------------------------------------------------------------------------
+IntExpr1 mod +IntExpr2
    Modulo:  Result = IntExpr1 - (IntExpr1 // IntExpr2)  * IntExpr1

+IntExpr1 rem +IntExpr2
    Remainder of division:  Result = float_fractional_part(IntExpr1/IntExpr2)

+IntExpr1 // +IntExpr2
    Integer division:  Result = truncate(Expr1/Expr2)
------------------------------------------------------------------------------

If someone thinks this is still wrong, please let me know.

	--- Jan