Re: remainder() is not right
- Posted by Jeremy Cowgar <jeremy at ?owg?r.com> May 05, 2008
- 1047 views
I've added mod() to the standard library
global function mod(atom x, atom y) return x - y * floor(x / y) end function
The test cases all pass:
test_equal("mod() #1", 3573, mod(-27, 3600)) test_equal("mod() #2", 3573, mod(-3627, 3600)) test_equal("mod() #3", -27, mod(-3627, -3600)) test_equal("mod() #4", -3573, mod(27, -3600)) test_equal("mod() #5", 0, mod(10, 2))
Should I add any other tests to test for any strange parameters? -- Jeremy Cowgar http://jeremy.cowgar.com