summaryrefslogtreecommitdiff
path: root/t/op
diff options
context:
space:
mode:
authorJarkko Hietaniemi <jhi@iki.fi>2016-10-27 07:46:22 -0400
committerJarkko Hietaniemi <jhi@iki.fi>2016-10-28 22:04:48 -0400
commit85272d315820be85a9069783ae2be8878e1e42a4 (patch)
tree35bdaf1813054f56cbefb0fa9f3c4e8dd7768860 /t/op
parent4cb05021f1602b1c29295f791d76ba4b38426f2a (diff)
downloadperl-85272d315820be85a9069783ae2be8878e1e42a4.tar.gz
Use the new metalevel definitions for fp inf/nan/range
There are still hacks (in a good sense) of detecting "vax float" in the cpan/ modules (patches submitted upstream, customized moves done), but that is fine since the new Config symbols will be available only in the future.
Diffstat (limited to 't/op')
-rw-r--r--t/op/hexfp.t3
-rw-r--r--t/op/inc.t8
-rw-r--r--t/op/infnan.t4
-rw-r--r--t/op/pack.t8
-rw-r--r--t/op/sprintf2.t12
5 files changed, 12 insertions, 23 deletions
diff --git a/t/op/hexfp.t b/t/op/hexfp.t
index bdf1e95d8d..29378f29af 100644
--- a/t/op/hexfp.t
+++ b/t/op/hexfp.t
@@ -248,8 +248,7 @@ SKIP: {
skip("non-80-bit-long-double", 4)
unless ($Config{uselongdouble} &&
($Config{nvsize} == 16 || $Config{nvsize} == 12) &&
- ($Config{longdblkind} == 3 ||
- $Config{longdblkind} == 4));
+ ($Config{long_double_style_ieee_extended}));
is(0x1p-1074, 4.94065645841246544e-324);
is(0x1p-1075, 2.47032822920623272e-324, '[perl #128919]');
is(0x1p-1076, 1.23516411460311636e-324);
diff --git a/t/op/inc.t b/t/op/inc.t
index 20d4769657..c685a70ce2 100644
--- a/t/op/inc.t
+++ b/t/op/inc.t
@@ -188,13 +188,11 @@ cmp_ok($a, '==', 2147483647, "postdecrement properly downgrades from double");
SKIP: {
if ($Config{uselongdouble} &&
- ($Config{longdblkind} == 6 || $Config{longdblkind} == 5)) {
+ ($Config{long_double_style_ieee_doubledouble})) {
skip "the double-double format is weird", 1;
}
- if ($Config{doublekind} == 9 ||
- $Config{doublekind} == 10 ||
- $Config{doublekind} == 11) {
- skip "the VAX format is not IEEE", 1;
+ unless ($Config{double_style_ieee}) {
+ skip "the doublekind $Config{doublekind} is not IEEE", 1;
}
# I'm sure that there's an IBM format with a 48 bit mantissa
diff --git a/t/op/infnan.t b/t/op/infnan.t
index b50d6e68d5..1f68cff8c1 100644
--- a/t/op/infnan.t
+++ b/t/op/infnan.t
@@ -16,9 +16,7 @@ BEGIN {
# but Inf is completely broken (e.g. Inf + 0 -> NaN).
skip_all "$^O with long doubles does not have sane inf/nan";
}
- if ($Config{doublekind} == 9 ||
- $Config{doublekind} == 10 ||
- $Config{doublekind} == 11) {
+ unless ($Config{d_double_has_inf} && $Config{d_double_has_nan}) {
skip_all "the doublekind $Config{doublekind} does not have inf/nan";
}
}
diff --git a/t/op/pack.t b/t/op/pack.t
index 014fbc55ac..3fc12e4241 100644
--- a/t/op/pack.t
+++ b/t/op/pack.t
@@ -50,8 +50,6 @@ for my $size ( 16, 32, 64 ) {
my $IsTwosComplement = pack('i', -1) eq "\xFF" x $Config{intsize};
print "# \$IsTwosComplement = $IsTwosComplement\n";
-my $vax_float = (pack("d", 1) =~ /^[\x80\x10]\x40/);
-
sub is_valid_error
{
my $err = shift;
@@ -297,7 +295,7 @@ sub list_eq ($$) {
# Is this a stupid thing to do on VMS, VOS and other unusual platforms?
skip("-- the IEEE infinity model is unavailable in this configuration.", 1)
- if (($^O eq 'VMS') && !defined($Config{useieee}) || $vax_float);
+ if (($^O eq 'VMS') && !defined($Config{useieee}) || !$Config{d_double_has_inf});
skip("-- $^O has serious fp indigestion on w-packed infinities", 1)
if (
@@ -322,7 +320,7 @@ sub list_eq ($$) {
SKIP: {
skip("-- the full range of an IEEE double may not be available in this configuration.", 3)
- if (($^O eq 'VMS') && !defined($Config{useieee}) || $vax_float);
+ if (($^O eq 'VMS') && !defined($Config{useieee}) || !$Config{d_double_style_ieee});
skip("-- $^O does not like 2**1023", 3)
if (($^O eq 'ultrix'));
@@ -1534,7 +1532,7 @@ is(unpack('c'), 65, "one-arg unpack (change #18751)"); # defaulting to $_
is($x[1], $y[1], "checksum advance ok");
SKIP: {
- skip("-- VAX float", 1) if $vax_float;
+ skip("-- non-IEEE float", 1) if !$Config{d_double_style_ieee};
# verify that the checksum is not overflowed with C0
is(unpack("C0%128U", "abcd"), unpack("U0%128U", "abcd"), "checksum not overflowed");
}
diff --git a/t/op/sprintf2.t b/t/op/sprintf2.t
index 8b9931fae3..56ef3e27c0 100644
--- a/t/op/sprintf2.t
+++ b/t/op/sprintf2.t
@@ -528,10 +528,8 @@ for my $num (0, -1, 1) {
}
}
-my $vax_float = (pack("d", 1) =~ /^[\x80\x10]\x40/);
-
SKIP: {
- if ($vax_float) { skip "VAX float has no Inf or NaN", 3 }
+ unless ($Config{d_double_has_inf} && $Config{d_double_has_nan}) { skip "no Inf or NaN in doublekind $Config{doublekind}", 3 }
# test that %f doesn't panic with +Inf, -Inf, NaN [perl #45383]
foreach my $n ('2**1e100', '-2**1e100', '2**1e100/2**1e100') { # +Inf, -Inf, NaN
eval { my $f = sprintf("%f", eval $n); };
@@ -600,7 +598,7 @@ is $o::count, 0, 'sprintf %d string overload count is 0';
is $o::numcount, 1, 'sprintf %d number overload count is 1';
SKIP: { # hexfp
- if ($vax_float) { skip "VAX float no hexfp", scalar @hexfloat }
+ unless ($Config{d_double_style_ieee}) { skip "no IEEE, no hexfp", scalar @hexfloat }
my $ppc_linux = $Config{archname} =~ /^(?:ppc|power(?:pc)?)(?:64)?-linux/;
my $irix_ld = $Config{archname} =~ /^IP\d+-irix-ld$/;
@@ -696,8 +694,7 @@ SKIP: {
skip("uselongdouble=" . ($Config{uselongdouble} ? 'define' : 'undef')
. " longdblkind=$Config{longdblkind} os=$^O", 6)
unless ($Config{uselongdouble} &&
- ($Config{longdblkind} == 5 ||
- $Config{longdblkind} == 6)
+ ($Config{long_double_style_ieee_doubledouble})
# Gating on 'linux' (ppc) here is due to the differing
# double-double implementations: other (also big-endian)
# double-double platforms (e.g. AIX on ppc or IRIX on mips)
@@ -862,8 +859,7 @@ SKIP: {
skip("non-80-bit-long-double", 17)
unless ($Config{uselongdouble} &&
($Config{nvsize} == 16 || $Config{nvsize} == 12) &&
- ($Config{longdblkind} == 3 ||
- $Config{longdblkind} == 4));
+ ($Config{long_double_style_ieee_extended}));
{
# The last normal for this format.