summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicholas Clark <nick@ccl4.org>2010-03-11 14:08:07 +0000
committerNicholas Clark <nick@ccl4.org>2010-03-11 14:08:07 +0000
commit9fa8ecf2a3ca91ec626e605a91e2840b8755036e (patch)
tree19435b7f1808bf2c0bbf78473effbcf74d25388a
parent4c1069378194cb28b7554e5db5a450e0595b43f4 (diff)
downloadperl-9fa8ecf2a3ca91ec626e605a91e2840b8755036e.tar.gz
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.
-rw-r--r--lib/overload.t4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/overload.t b/lib/overload.t
index 39333cff87..734e8b1716 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');
}