In Lua 5.3 "-3%5 == 2", according to my programmers calculator and several other programing languages I tried this _expression_ in, the real result is -3.
On the other hand "5%-3 == 2", so maybe the result is correct, and the bug is simply reversed operands if one is negative?
I discovered this because I am adding tests (based on the official Lua tests) to my Go Lua VM, and one of the tests failed because the incorrect result is coded into the test.
Secondly, -3%5 == 2 because floor(-3/5) = -1, and (-1)*5+2 = -5+2 = -3.
s/research/publication/divisio n-and-modulus-for-computer-sci entists/
small-practical-example-where- luas-behavior-is-better-than-c s/
etc. This is an endless argument.
Thirdly, in case you're still reading this for some unknown reason, RTFM always applies:
"Modulo is defined as the remainder of a division that rounds the quotient towards minus infinity (floor division)."
Disclaimer: these emails may be made public at any given time, with or without reason. If you don't agree with this, DO NOT REPLY.