diff options
author | Jarkko Hietaniemi <jhi@iki.fi> | 2001-10-01 17:04:18 +0000 |
---|---|---|
committer | Jarkko Hietaniemi <jhi@iki.fi> | 2001-10-01 17:04:18 +0000 |
commit | 800e6488b45c59f1e13d57d870eed97d36a4ad6e (patch) | |
tree | d3977c19e70895aba217e1ecbc3661a3c15222be /t/op/arith.t | |
parent | 217f68ed0bd0c71deba20ad41acaf5f911cd2130 (diff) | |
download | perl-800e6488b45c59f1e13d57d870eed97d36a4ad6e.tar.gz |
UNICOS testing patches from Nicholas Clark.
p4raw-id: //depot/perl@12297
Diffstat (limited to 't/op/arith.t')
-rwxr-xr-x | t/op/arith.t | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/t/op/arith.t b/t/op/arith.t index 890c78f3c4..6e61477baf 100755 --- a/t/op/arith.t +++ b/t/op/arith.t @@ -12,6 +12,18 @@ sub tryeq ($$$) { print "not ok $_[0] # $_[1] != $_[2]\n"; } } +sub tryeq_sloppy ($$$) { + if ($_[1] == $_[2]) { + print "ok $_[0]\n"; + } else { + my $error = abs ($_[1] - $_[2]) / $_[1]; + if ($error < 1e-10) { + print "ok $_[0] # $_[1] is close to $_[2], \$^O eq $^O\n"; + } else { + print "not ok $_[0] # $_[1] != $_[2]\n"; + } + } +} tryeq 1, 13 % 4, 1; tryeq 2, -13 % 4, 3; @@ -233,7 +245,7 @@ tryeq 125, -4.5 / 2, -2.25; tryeq 126, -5.5 / -2, 2.75; # Bluuurg if your floating point can't accurately cope with powers of 2 -tryeq 127, 18446744073709551616/1, 18446744073709551616; +tryeq_sloppy 127, 18446744073709551616/1, 18446744073709551616; # Bluuurg tryeq 128, 18446744073709551616/2, 9223372036854775808; tryeq 129, 18446744073709551616/4294967296, 4294967296; tryeq 130, 18446744073709551616/9223372036854775808, 2; |