Definition of % operator may be wrong for negative divisors #16339
This is a bug report for perl from email@example.com,
Hello, The documentation of the '%' operator for negative divisors seems
"If $n is negative, then "$m % $n" is $m minus the smallest multiple
For example 91 % -10 = -9 ; instantiating $m = 91 and $n = -10 produces
"91 % -10 is 91 minus the smallest multiple of -10 that is not less than 91"
which is impossible, since no multiple of a negative number is >= a positive.
My _guess_ is that a correct definitin is:
"If $n is negative, then "$m % $n" is $m plus the largest multiple
That works for the examples I've tried, including the one abive where
Someone who knows this deeply should fix the definition in perlop.
Site configuration information for perl 5.26.0:
Configured by Debian Project at Fri Sep 15 16:13:42 UTC 2017.
Summary of my perl5 (revision 5 version 26 subversion 0) configuration:
Locally applied patches:
@INC for perl 5.26.0:
Environment for perl 5.26.0:
via RT wrote:
Multiples that arise from multiplying by a negative integer count.
That would be less clear. "Largest" isn't a synonym for "greatest",
The documentation is fine as it is.