lua-users home
lua-l archive

Re: [Bug] math.mod behaves differently than the modulus operator.

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


The manual doesn't claim that % and math.mod are the same, it simply says:
a % b == a - math.floor(a/b)*b
And in this case that IS consistent with your observed results.
Polarina wrote:
math.mod behaves differently than the modulus operator.
How to reproduce:
= math.mod(7, -(1 / 0))
7
= 7 % -(1 / 0)
nan

AltStyle によって変換されたページ (->オリジナル) /