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

Re: Bug with modulo operator and negative operands

Thread Previous
From:
Jarkko Hietaniemi
Date:
October 24, 2001 12:55
Subject:
Re: Bug with modulo operator and negative operands
Message ID:
20011024225538.G3778@alpha.hut.fi
On Wed, Oct 24, 2001 at 08:41:07PM +0100, Nick Ing-Simmons wrote:
> 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)

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++; # http://www.iki.fi/jhi/
        # There is this special biologist word we use for 'stable'.
        # It is 'dead'. -- Jack Cohen

Thread Previous


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