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

Re: [ID 20010305.005] "use integer" doesn't make rand() return integers

Thread Previous | Thread Next
From:
John L. Allen
Date:
March 8, 2001 07:31
Subject:
Re: [ID 20010305.005] "use integer" doesn't make rand() return integers
Message ID:
Pine.SOL.3.91.1010308102346.3159A-100000@gateway.grumman.com


On Wed, 7 Mar 2001, Ronald J Kimball wrote:

> On Wed, Mar 07, 2001 at 11:15:33PM +0100, abigail@foad.org wrote:
> > After all, does it make any sense that '* 1' isn't an identity operation?
> > 
> > I find:
> > 
> >     1 * sin (1) != sin (1)
> > 
> > to be utterly unintuitive. Now, I don't really care in this case because
> > trig functions aren't particular useful when doing integer arithmetic.
> 
> How do you feel about:
> 
>     1 * 3.5 != 3.5
> 
> ?  (Except that when you do the comparison, the operands are truncated to
> integers.  :)

Wow.  The fact that "use integer" affects comparison operators too does not
seem to be mentioned anywhere in the pods.  Not even in my recent patch to
integer.pm :-). I have a fix for that, but before I send it, should 
"use integer" affect the increment and decrement ops?  It doesn't now.  I 
think I'd call that a bug.

	perl -Minteger -e '$x=1.3; --$x; print "$x "; ++$x; print $x'        
	0.3 1.3

John.

PS - integer.pm also had a busted pod link L<perlmod/Pragmatic Modules>, 
which I changed to L<perlmodlib/"Pragmatic Modules">.  Is there someone 
who has code to check for broken pod links?

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