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

[PATCH] Re: [perl #45133] perlbug AutoReply: -0.0 has variable Boolean value

From:
Father Chrysostomos
Date:
August 8, 2010 12:15
Subject:
[PATCH] Re: [perl #45133] perlbug AutoReply: -0.0 has variable Boolean value
Message ID:
52BA82B2-C0A4-40C6-A5BD-08B9DB1CC4F5@cpan.org
I think stringifying -0.0 as 0 is the best solution to this. And it seems that Larry Wall was also planning to have perl do that, or was at least toying with the idea. Since version 5.00, there has been an #ifdef FIXNEGATIVEZERO that does it this way. This patch simple removes that #ifdef.

Here are some tests. I have no idea where to put them. t/op/numconvert.t sounds like the right place, but is not structured in a way that fits these tests:

ok(-0.0 eq "0", 'negative zero stringifies as 0');
ok(!-0.0, "neg zero is boolean false");
my $nz = -0.0; "$nz"; ok(!$nz, 'previously stringified -0.0 is boolean false');



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