develooper Front page | perl.perl5.porters | Postings from January 2008

[perl #50364] [PATCH] perlop.pod - misnomer in % operator documentation

Thread Next
From:
mhasch @ cpan . org
Date:
January 28, 2008 18:02
Subject:
[perl #50364] [PATCH] perlop.pod - misnomer in % operator documentation
Message ID:
rt-3.6.HEAD-4355-1201568166-693.50364-75-0@perl.org
# New Ticket Created by  mhasch@cpan.org 
# Please include the string:  [perl #50364]
# in the subject line of all future correspondence about this issue. 
# <URL: http://rt.perl.org/rt3/Ticket/Display.html?id=50364 >


This is a bug report for perl from mhasch@cpan.org,
generated with the help of perlbug 1.36 running under perl 5.10.0.


-----------------------------------------------------------------
There is a misnomer in the documentation of the % operator.

You don't calculate the modulus of two numbers.  You calculate the
common residue or remainder of a number with respect to a modulus.
Thus, in "A = B % C", C is the modulus, while A should be called
something like common residue or remainder in integer division.

I suggest to fix the paragraph on % in perlop.pod with the patch
attached below.

Martin Becker (aka Martin Hasch) <mhasch(at)cpan.org>

diff -ru perl-5.10.0/pod/perlop.pod perl-5.10.0-patched/pod/perlop.pod
--- perl-5.10.0/pod/perlop.pod  Tue Dec 18 11:47:08 2007
+++ perl-5.10.0-patched/pod/perlop.pod  Tue Jan 29 00:19:31 2008
@@ -260,7 +260,7 @@
 Binary "/" divides two numbers.
 X</> X<slash>

-Binary "%" computes the modulus of two numbers.  Given integer
+Binary "%" computes the division remainder of two numbers.  Given integer
 operands C<$a> and C<$b>: If C<$b> is positive, then C<$a % $b> is
 C<$a> minus the largest multiple of C<$b> that is not greater than
 C<$a>.  If C<$b> is negative, then C<$a % $b> is C<$a> minus the


-----------------------------------------------------------------
---
Flags:
    category=docs
    severity=low
---
Site configuration information for perl 5.10.0:

[Deleted -- platform details considered irrelevant]


Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About