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

Re: PATCH: srand returns the seed

Thread Previous | Thread Next
From:
Bo Lindbergh
Date:
July 29, 2010 20:43
Subject:
Re: PATCH: srand returns the seed
Message ID:
201007291818.o6TIIDbc027935@brev.stacken.kth.se
(Ben Morrow) wrote:
> Quoth jand@activestate.com ("Jan Dubois"):
> > 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 that makes number->string->number round-tripping unreliable, which
> was the whole reason for stringifying as "-0" in the first place. Lots
> of code assumes that stringification preserves information.

Except that "-0" doesn't numify to negative zero.
"-0.0" and "-0." do (on darwin-ppc, at least).

{
    print "'$_'\t=> ",$_/1,"\n" foreach qw( -0.0 -0. -0 );
}


/Bo Lindbergh

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