Files
mercury/tests/hard_coded/division_test.exp
Fergus Henderson 4f41a1b7c2 Clean up the handlng of integer division and remainder.
library/int.m:
	Add a new function `div'.  The idea is that `div' is the same
	as `//', except that `div' will round toward minus infinity, whereas
	`//' will round toward zero.  `div' is more well-behaved, `//'
	is more efficient.

	Change the behaviour of `mod' so that it is remainder after `div'
	rather than remainder after `//'.  This makes it more well-behaved,
	but less efficient.

	Add a new function `rem', which is the new name for what `mod'
	used to do (i.e. remainder after `//').

compiler/llds.m:
	Add some comments about the `/' and `mod' llds operators.
	(The `mod' llds operator should probably be renamed `rem',
	but I haven't done that yet.)

compiler/code_util.m:
	Recognize `int:rem', rather than `int:mod', as the llds `mod'
	operator.

tests/hard_coded/division_test.m:
	Add some test cases for `div', `mod', `//', and `rem' on
	negative numbers.
1997-03-21 10:57:45 +00:00

5 lines
77 B
Plaintext

`//' test succeeded
rem test succeeded
div test succeeded
mod test succeeded