From: Nicholas Clark Date: Thu, 11 Mar 2010 14:08:07 +0000 (+0000) Subject: Fix stringification assumption bug in overload.t, revealed by ia64-linux-ld. X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=9fa8ecf2a3ca91ec626e605a91e2840b8755036e;p=p5sagit%2Fp5-mst-13.2.git Fix stringification assumption bug in overload.t, revealed by ia64-linux-ld. Specifically: 1: / returns and NV where possible, only returning an integer if the dividend is an integer larger than an NV can represent accurately, and integer division is exact (ie no fractional part/remainder). 2: The test is performing $ref/1, intending it to be an identity operation on the numeric value of the reference. 3: The test assumes that the return result of the division will be a number that stringifies identically to the integer value of the reference. The fails if both: 1: The system memory map is such that addresses are very large (ia64 does) 2: NVs are large enough to hold these addresses because then the address becomes converted to an NV which has sufficient decimal digits that stringification defaults to scientific notation. Itanium Linux users the world over will be cheering because they can now compile Perl with long doubles with confidence that all tests pass. --- diff --git a/lib/overload.t b/lib/overload.t index 39333cf..734e8b1 100644 --- a/lib/overload.t +++ b/lib/overload.t @@ -1558,7 +1558,7 @@ foreach my $op (qw(<=> == != < <= > >=)) { is($m+$m, 2*$num_val, 'numifies to usual reference value'); is(0-$m, -$num_val, 'numifies to usual reference value'); is(1*$m, $num_val, 'numifies to usual reference value'); - is($m/1, $num_val, 'numifies to usual reference value'); + is(int($m/1), $num_val, 'numifies to usual reference value'); is($m%100, $num_val%100, 'numifies to usual reference value'); is($m**1, $num_val, 'numifies to usual reference value'); @@ -1569,7 +1569,7 @@ foreach my $op (qw(<=> == != < <= > >=)) { is($aref+$aref, 2*$num_val, 'ref addition'); is(0-$aref, -$num_val, 'subtraction of ref'); is(1*$aref, $num_val, 'multiplicaton of ref'); - is($aref/1, $num_val, 'division of ref'); + is(int($aref/1), $num_val, 'division of ref'); is($aref%100, $num_val%100, 'modulo of ref'); is($aref**1, $num_val, 'exponentiation of ref'); }