develooper Front page | perl.perl5.porters | Postings from October 2001

Re: Bug with modulo operator and negative operands

Thread Previous | Thread Next
From:
Nick Ing-Simmons
Date:
October 24, 2001 12:43
Subject:
Re: Bug with modulo operator and negative operands
Message ID:
20011024194303.664.3@bactrian.ni-s.u-net.com
John Peacock <jpeacock@rowman.com> writes:
>I indeed get 
>
>	-11 % 2 = -1
>
>which at least agrees with the information I can glean from the ANSI C
>rationalization regarding the div() function.  

But "p5p" the Standards body for "Standard Perl" has declared 
that Perl gives the mathematical result. (IIRC)

>
>Regardless of the validity of the argument that the modulo should
>be -1 in this case, the 'use integer;' should have no effect on
>the answer on any single machine.

Says who ? - pragmatic modules can have pragmatic effects...

-- 
Nick Ing-Simmons
http://www.ni-s.u-net.com/


Thread Previous | 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