lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


"Tom Barta" <tbarta@gmail.com> writes:
> Out of curiosity, is there any explicit reason for math.mod() behaving
> differently than the modulus operator (%)?  It seems counterintuitive
> that they behave differently (despite the lack of a formal guarantee
> by the manual), but maybe I'm overlooking some case where the
> distinction is worthwhile.

Does the C standard guarantee the above behavior of % on negative
integers?  My memory is that it doesn't.

[I sort of thought that in the case of Lua, it was simply that it would
take extra code to simulate the common "C style", and that there was
little reason to do so as no C programmer in their right mind depends on
that behavior anyway...]

-Miles

-- 
[|nurgle|]  ddt- demonic? so quake will have an evil kinda setting? one that
            will  make every christian in the world foamm at the mouth?
[iddt]      nurg, that's the goal