[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
**Subject**: **Re: Bug modulo operator on negative numbers**
**From**: Francisco Olarte <folarte@...>
**Date**: Mon, 16 Aug 2021 19:47:53 +0200

John:
On Mon, Aug 16, 2021 at 5:38 PM John Erling Blad <jeblad@gmail.com> 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.