lua-users home
lua-l archive

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


On Mon, Aug 16, 2021 at 5:38 PM John Erling Blad <> wrote:
> There are several variants of modulo operations,[1] and the documentation isn't very clear on which variant is used by Lua. It is quite easy to get strange results when using algorithms that depend on modulo operations. Perhaps the doc should say something about the different versions.

Well my message, which you fully (bottom) quoted had a quote of the manual:

>> What is the problem? It is doing it per the manual.
>> "Floor division (//) is a division that rounds the quotient towards
>> minus infinity, resulting in the floor of the division of its
>> operands.
>> Modulo is defined as the remainder of a division that rounds the
>> quotient towards minus infinity (floor division). "

Which I think is pretty clear.

Francisco Olarte.