mirror of
https://github.com/Mercury-Language/mercury.git
synced 2026-04-15 17:33:38 +00:00
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.
5 lines
77 B
Plaintext
5 lines
77 B
Plaintext
`//' test succeeded
|
|
rem test succeeded
|
|
div test succeeded
|
|
mod test succeeded
|