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

Re: PATCH: srand returns the seed

Thread Previous | Thread Next
From:
Abigail
Date:
July 30, 2010 00:51
Subject:
Re: PATCH: srand returns the seed
Message ID:
20100730075236.GM3850@almanda
On Thu, Jul 29, 2010 at 08:18:11PM +0200, Bo Lindbergh wrote:
> (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 );
> }
> 
> 

It does for me (linux-i686).

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


Abigail

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