Re: remainder() is not right
- Posted by Jeremy Cowgar <jeremy at cow?ar?com> May 05, 2008
- 1077 views
Jeremy Cowgar wrote: > > I've added mod() to the standard library > > }}} <eucode> > global function mod(atom x, atom y) > return x - y * floor(x / y) > end function > </eucode> {{{ > > The test cases all pass: > > }}} <eucode> > 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)) > </eucode> {{{ > > Should I add any other tests to test for any strange parameters? > Hm, I went to document the new mod() function and went to: http://en.wikipedia.org/wiki/Modulo_operation To get some more descriptive information and noticed that Euphoria is listed there in the language table as supporting modulo operator and that it's function name is remainder() So, what's up with that? Is it not correct? I see that it's listed as: Dividend while others are Divisor. Ada, for instance, has rem() which is Dividend and mod() which is Divisor. -- Jeremy Cowgar http://jeremy.cowgar.com