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

Re: Bug with modulo operator and negative operands

Thread Previous
Jarkko Hietaniemi
October 24, 2001 12:55
Re: Bug with modulo operator and negative operands
Message ID:
On Wed, Oct 24, 2001 at 08:41:07PM +0100, Nick Ing-Simmons wrote:
> John Peacock <> 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)

Huh?  My recollection is that It Would Be Nice (TM) to fix this to
agree with the mathematics, but for backwards-bending compatibility
raisins we can't.

> >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...

$jhi++; #
        # There is this special biologist word we use for 'stable'.
        # It is 'dead'. -- Jack Cohen

Thread Previous Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About