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

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

Father Chrysostomos
August 8, 2010 12:15
[PATCH] Re: [perl #45133] perlbug AutoReply: -0.0 has variable Boolean value
Message ID:
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'); Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About