summaryrefslogtreecommitdiff
path: root/t/op/arith.t
diff options
context:
space:
mode:
authorPaul Green <Paul.Green@stratus.com>2002-03-12 14:22:00 -0500
committerJarkko Hietaniemi <jhi@iki.fi>2002-03-14 15:12:19 +0000
commit7f45fac236f26ae9ce0b7455315edbed1b12f481 (patch)
tree06462851a48b8aef47edce5acb11c6fce90db276 /t/op/arith.t
parent9cbc33e806e2f8d7266ad678b15e011463a8cd61 (diff)
downloadperl-7f45fac236f26ae9ce0b7455315edbed1b12f481.tar.gz
Better patch for Benchmark.t and arith.t
Message-Id: <200203130025.TAA20113@mailhub1.stratus.com> p4raw-id: //depot/perl@15226
Diffstat (limited to 't/op/arith.t')
-rwxr-xr-xt/op/arith.t29
1 files changed, 28 insertions, 1 deletions
diff --git a/t/op/arith.t b/t/op/arith.t
index 4205345a7e..55a5e48084 100755
--- a/t/op/arith.t
+++ b/t/op/arith.t
@@ -1,6 +1,11 @@
#!./perl -w
-print "1..133\n";
+BEGIN {
+ chdir 't' if -d 't';
+ @INC = '../lib';
+}
+
+print "1..134\n";
sub try ($$) {
print +($_[1] ? "ok" : "not ok"), " $_[0]\n";
@@ -269,3 +274,25 @@ tryeq 130, 18446744073709551616/9223372036854775808, 2;
my $t1000 = time() * 1000;
try 133, abs($t1000 -1000 * $t) <= 2000;
}
+
+if ($^O eq 'vos') {
+ print "not ok 134 # TODO VOS raises SIGFPE instead of producing infinity.\n";
+} else {
+ # The computation of $v should overflow and produce "infinity"
+ # on any system whose max exponent is less than 10**1506.
+ # The exact string used to represent infinity varies by OS,
+ # so we don't test for it; all we care is that we don't die.
+ #
+ # Perl considers it to be an error if SIGFPE is raised.
+ # Chances are the interpreter will die, since it doesn't set
+ # up a handler for SIGFPE. That's why this test is last; to
+ # minimize the number of test failures. --PG
+
+ my $n = 5000;
+ my $v = 2;
+ while (--$n)
+ {
+ $v *= 2;
+ }
+ print "ok 134\n";
+}