Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
p5pRT opened this issue Jan 29, 2008 · 3 comments
Closed

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

p5pRT opened this issue Jan 29, 2008 · 3 comments

Comments

@p5pRT
Copy link

p5pRT commented Jan 29, 2008

Migrated from rt.perl.org#50364 (status was 'resolved')

Searchable as RT50364$

@p5pRT
Copy link
Author

p5pRT commented Jan 29, 2008

From @mhasch

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>

Inline Patch
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]

@p5pRT
Copy link
Author

p5pRT commented Feb 8, 2008

@rgs - Status changed from 'new' to 'resolved'

@p5pRT p5pRT closed this as completed Feb 8, 2008
@p5pRT
Copy link
Author

p5pRT commented Feb 8, 2008

From @rgs

On 29/01/2008, via RT mhasch @​ cpan. org <perlbug-followup@​perl.org> wrote​:

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

Thanks, applied to bleadperl.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant