develooper Front page | perl.perl5.porters | Postings from July 2010

RE: [perl #76756] PATCH: srand returns the seed

Thread Previous | Thread Next
From:
Andy Dougherty
Date:
July 29, 2010 08:29
Subject:
RE: [perl #76756] PATCH: srand returns the seed
Message ID:
alpine.DEB.2.00.1007291126110.19748@fractal.phys.lafayette.edu
On Wed, 28 Jul 2010, Jan Dubois wrote:

> On Wed, 28 Jul 2010, Zefram wrote:
> > Jan Dubois wrote:
> > >Well, you _could_ add a special case to the string comparison:
> > 
> > That would be a mess.  The better solution is for negative zero to
> > stringify as "0".

But wouldn't that would eliminate the possibility of printing out a valid 
result of an IEEE-754 calculation?

> I'm more and more convinced that using a floating point number in
> boolean context is simply something you should not be doing for
> similar reasons that you generally are not comparing floating point
> numbers for equality.

Even in floating point, 0 is special.  When you know what you are doing, 
comparing for exactly 0 is both reasonable and reliable.

-- 
    Andy Dougherty		doughera@lafayette.edu

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