In perl.git, the branch blead has been updated <http://perl5.git.perl.org/perl.git/commitdiff/69c5d0e612c38cbd6e880e197337b13f0c92ffca?hp=b3de960c9ad0e39d5eff1c56932c46850c862067>
- Log ----------------------------------------------------------------- commit 69c5d0e612c38cbd6e880e197337b13f0c92ffca Author: Jarkko Hietaniemi <[email protected]> Date: Fri Oct 21 20:20:29 2016 -0400 POSIX version bump M ext/POSIX/lib/POSIX.pm commit b41db0e2a7beb0c664620a2ef961f245b6fc8599 Author: Jarkko Hietaniemi <[email protected]> Date: Fri Oct 21 09:16:28 2016 -0400 vax-netbsd: no nan M t/lib/warnings/9uninit commit 0e25d864d83173c105cdabb68813b14c94bae966 Author: Jarkko Hietaniemi <[email protected]> Date: Fri Oct 21 09:05:25 2016 -0400 vax-netbsd: do not tempt fp overflow, which will SIGFPE The 3e100 seems to have no special meaning, except being in floating point. M dist/Carp/t/arg_string.t commit 118e30669f30a468e87dba7af3669a3a29bd1f37 Author: Jarkko Hietaniemi <[email protected]> Date: Fri Oct 21 08:58:38 2016 -0400 vax-netbsd: no PL_inf/PL_nan to export M t/porting/globvar.t commit c6303df568d3f2eb3ba7a65354c7f8aa4b2e921c Author: Jarkko Hietaniemi <[email protected]> Date: Fri Oct 21 08:54:07 2016 -0400 vax-netbsd: do not test for inf/nan M ext/XS-APItest/t/grok.t commit 3abfcf99a04030f74a31ef77ae4c2563c046ea99 Author: Jarkko Hietaniemi <[email protected]> Date: Fri Oct 21 08:44:04 2016 -0400 vax-netbsd: test non-IEEE-754-ness only once M ext/POSIX/t/math.t commit 9ec6051125f905d725726b79ce9b4ad491cea421 Author: Jarkko Hietaniemi <[email protected]> Date: Fri Oct 21 08:40:02 2016 -0400 vax-netbsd: set the RETVAL even if unused M ext/POSIX/POSIX.xs commit b76dad153351f50f46ba283bb0da075b93e89838 Author: Jarkko Hietaniemi <[email protected]> Date: Fri Oct 21 08:33:16 2016 -0400 Configure: signbit scan assuming too much It was assuming a negative zero, which is an IEEE-754 only concept. There is no need to assume the negative zero for the correct functioning of the signbit, however. M Configure commit 98492e812e730560d7b5aad699aa532f7369a8d0 Author: Jarkko Hietaniemi <[email protected]> Date: Fri Oct 21 08:29:27 2016 -0400 vax-netbsd: another negative zero assumption Though this had been masked by NV_INF guard. M ext/POSIX/POSIX.xs commit 0c61ae02299600bef03a658fcaefd0252964c4b8 Author: Jarkko Hietaniemi <[email protected]> Date: Fri Oct 21 08:27:47 2016 -0400 vax-netbsd: Negative zero is only a thing IEEE 754. So don't assume it universal in the signbit emulation. For non-IEEE-754, negative zero is equal to the positive zero. (Another matter is that signbit() should have been found in the Configure scan; it does exist in the netbsd/vax.) M ext/POSIX/POSIX.xs commit bd294f6471d5d4f40e13a19a5840352c24d781ef Author: Jarkko Hietaniemi <[email protected]> Date: Fri Oct 21 07:59:20 2016 -0400 vax-netbsd: expand lround() and signbit testing M ext/POSIX/t/math.t ----------------------------------------------------------------------- Summary of changes: Configure | 2 +- dist/Carp/t/arg_string.t | 2 +- ext/POSIX/POSIX.xs | 14 +++++++++++++- ext/POSIX/lib/POSIX.pm | 2 +- ext/POSIX/t/math.t | 31 +++++++++++++++++-------------- ext/XS-APItest/t/grok.t | 8 ++++++++ t/lib/warnings/9uninit | 17 ++++++++++++++--- t/porting/globvar.t | 9 +++++++++ 8 files changed, 64 insertions(+), 21 deletions(-) diff --git a/Configure b/Configure index 7c598e9..a68b670 100755 --- a/Configure +++ b/Configure @@ -18802,7 +18802,7 @@ $cat >try.c <<EOCP int main(int argc, char **argv) { NV x = 0.0; - NV y = -0.0; + NV y = -1.0; if ((signbit(x) == 0) && (signbit(y) != 0)) return 0; else diff --git a/dist/Carp/t/arg_string.t b/dist/Carp/t/arg_string.t index dbd2e6e..c94ec48 100644 --- a/dist/Carp/t/arg_string.t +++ b/dist/Carp/t/arg_string.t @@ -22,7 +22,7 @@ like lm(3), qr/main::lm\(3\)/; like lm(substr("3\x{2603}", 0, 1)), qr/main::lm\(3\)/; like lm(-3), qr/main::lm\(-3\)/; like lm(-3.5), qr/main::lm\(-3\.5\)/; -like lm(-3.5e100), qr/main::lm\(-3\.5[eE]\+?100\)/; +like lm(-3.5e30), qr/main::lm\(-3\.5[eE]\+?30\)/; like lm(""), qr/main::lm\(""\)/; like lm("foo"), qr/main::lm\("foo"\)/; like lm("a\$b\@c\\d\"e"), qr/main::lm\("a\\\$b\\\@c\\\\d\\\"e"\)/; diff --git a/ext/POSIX/POSIX.xs b/ext/POSIX/POSIX.xs index b573f5e..a9da973 100644 --- a/ext/POSIX/POSIX.xs +++ b/ext/POSIX/POSIX.xs @@ -837,7 +837,11 @@ static NV my_tgamma(NV x) #endif #ifdef NV_INF if (x == 0.0 || x == NV_INF) +#ifdef DOUBLE_IS_IEEE_FORMAT return x == -0.0 ? -NV_INF : NV_INF; +#else + return NV_INF; +#endif #endif /* The function domain is split into three intervals: @@ -2636,7 +2640,12 @@ fpclassify(x) #ifdef Perl_signbit RETVAL = Perl_signbit(x); #else - RETVAL = (x < 0) || (x == -0.0); + RETVAL = (x < 0); +#ifdef DOUBLE_IS_IEEE_FORMAT + if (x == -0.0) { + RETVAL = TRUE; + } +#endif #endif break; } @@ -2651,6 +2660,7 @@ getpayload(nv) RETVAL = S_getpayload(nv); #else PERL_UNUSED_VAR(nv); + RETVAL = 0.0; not_here("getpayload"); #endif OUTPUT: @@ -2695,6 +2705,7 @@ issignaling(nv) RETVAL = Perl_isnan(nv) && NV_NAN_IS_SIGNALING(&nv); #else PERL_UNUSED_VAR(nv); + RETVAL = 0.0; not_here("issignaling"); #endif OUTPUT: @@ -2925,6 +2936,7 @@ nan(payload = 0) #ifdef NV_NAN RETVAL = NV_NAN; #else + RETVAL = 0.0; not_here("nan"); #endif } else { diff --git a/ext/POSIX/lib/POSIX.pm b/ext/POSIX/lib/POSIX.pm index 5d96e69..dcf028f 100644 --- a/ext/POSIX/lib/POSIX.pm +++ b/ext/POSIX/lib/POSIX.pm @@ -4,7 +4,7 @@ use warnings; our ($AUTOLOAD, %SIGRT); -our $VERSION = '1.73'; +our $VERSION = '1.74'; require XSLoader; diff --git a/ext/POSIX/t/math.t b/ext/POSIX/t/math.t index 47841fc..adb5de5 100644 --- a/ext/POSIX/t/math.t +++ b/ext/POSIX/t/math.t @@ -55,13 +55,15 @@ between(0.76, tanh(1), 0.77, 'tanh(1)'); between(-0.77, tanh(-1), -0.76, 'tanh(-1)'); cmp_ok(tanh(1), '==', -tanh(-1), 'tanh(1) == -tanh(-1)'); +my $non_ieee_fp = ($Config{doublekind} == 9 || + $Config{doublekind} == 10 || + $Config{doublekind} == 11); + SKIP: { skip "no fpclassify", 4 unless $Config{d_fpclassify}; is(fpclassify(1), FP_NORMAL, "fpclassify 1"); is(fpclassify(0), FP_ZERO, "fpclassify 0"); - skip("no inf/nan", 2) if ($Config{doublekind} == 9 || - $Config{doublekind} == 10 || - $Config{doublekind} == 11); + skip("no inf/nan", 2) if $non_ieee_fp; is(fpclassify(INFINITY), FP_INFINITE, "fpclassify INFINITY"); is(fpclassify(NAN), FP_NAN, "fpclassify NAN"); } @@ -102,9 +104,7 @@ SKIP: { ok(!isinf(42), "isinf 42"); ok(!isnan(42), "isnan Inf"); SKIP: { - skip("no inf/nan", 9) if ($Config{doublekind} == 9 || - $Config{doublekind} == 10 || - $Config{doublekind} == 11); + skip("no inf/nan", 9) if $non_ieee_fp; ok(!isfinite(Inf), "isfinite Inf"); ok(!isfinite(NaN), "isfinite NaN"); ok(isinf(INFINITY), "isinf INFINITY"); @@ -120,14 +120,20 @@ SKIP: { near(log2(8), 3, "log2", 1e-9); is(signbit(2), 0, "signbit 2"); # zero ok(signbit(-2), "signbit -2"); # non-zero + is(signbit(0), 0, "signbit 0"); # zero + is(signbit(0.5), 0, "signbit 0.5"); # zero + ok(signbit(-0.5), "signbit -0.5"); # non-zero is(round(2.25), 2, "round 2.25"); is(round(-2.25), -2, "round -2.25"); is(round(2.5), 3, "round 2.5"); is(round(-2.5), -3, "round -2.5"); is(round(2.75), 3, "round 2.75"); is(round(-2.75), -3, "round 2.75"); - is(lround(-2.75), -3, "lround -0.25"); - is(signbit(lround(-0.25)), 0, "lround -0.25 -> +0"); # unlike round() + is(lround(-2.75), -3, "lround -2.75"); + is(lround(-0.25), 0, "lround -0.25"); + is(lround(-0.50), -1, "lround -0.50"); + is(signbit(lround(-0.25)), 0, "signbit lround -0.25 zero"); + ok(signbit(lround(-0.50)), "signbit lround -0.50 non-zero"); # non-zero is(trunc(2.25), 2, "trunc 2.25"); is(trunc(-2.25), -2, "trunc -2.25"); is(trunc(2.5), 2, "trunc 2.5"); @@ -141,9 +147,7 @@ SKIP: { ok(islessequal(1, 1), "islessequal 1 1"); SKIP: { - skip("no inf/nan", 2) if ($Config{doublekind} == 9 || - $Config{doublekind} == 10 || - $Config{doublekind} == 11); + skip("no inf/nan", 2) if $non_ieee_fp; ok(!isless(1, NaN), "isless 1 NaN"); ok(isunordered(1, NaN), "isunordered 1 NaN"); } @@ -165,9 +169,8 @@ SKIP: { near(lgamma(9), 10.6046029027452, "lgamma 9", 1.5e-7); SKIP: { - skip("no inf/nan", 19) if ($Config{doublekind} == 9 || - $Config{doublekind} == 10 || - $Config{doublekind} == 11); + skip("no inf/nan", 19) if $non_ieee_fp; + # These don't work on old mips/hppa platforms # because nan with payload zero == Inf (or == -Inf). # ok(isnan(setpayload(0)), "setpayload zero"); diff --git a/ext/XS-APItest/t/grok.t b/ext/XS-APItest/t/grok.t index c3169ce..810ffae 100644 --- a/ext/XS-APItest/t/grok.t +++ b/ext/XS-APItest/t/grok.t @@ -103,6 +103,14 @@ my @groks = [ "nanx", PERL_SCAN_TRAILING, undef, IS_NUMBER_NAN | IS_NUMBER_NOT_INT | IS_NUMBER_TRAILING ], ); +my $non_ieee_fp = ($Config{doublekind} == 9 || + $Config{doublekind} == 10 || + $Config{doublekind} == 11); + +if ($non_ieee_fp) { + @groks = grep { $_->[0] !~ /^(?:inf|nan)/i } @groks; +} + for my $grok (@groks) { my ($out_flags, $out_uv) = grok_number_flags($grok->[0], $grok->[1]); is($out_uv, $grok->[2], "'$grok->[0]' flags $grok->[1] - check number"); diff --git a/t/lib/warnings/9uninit b/t/lib/warnings/9uninit index b8fd925..fd63020 100644 --- a/t/lib/warnings/9uninit +++ b/t/lib/warnings/9uninit @@ -668,7 +668,18 @@ Use of uninitialized value in sort at - line 14. Use of uninitialized value in sort at - line 21. Use of uninitialized value in sort at - line 22. ######## -my $nan = sin 9**9**9; +use Config; +my $non_ieee_fp = ($Config{doublekind} == 9 || + $Config{doublekind} == 10 || + $Config{doublekind} == 11); +if ($non_ieee_fp) { + print <<EOM ; +SKIPPED +# No nan support +EOM + exit ; +} +my $nan = eval 'sin 9**9**9'; if ($nan == $nan) { print <<EOM ; SKIPPED @@ -681,8 +692,8 @@ use warnings 'uninitialized'; @sort = sort { ($a)[0] <=> $b } 1, $nan; @sort = sort { $a <=> $b } 1, $nan; EXPECT -Use of uninitialized value in sort at - line 11. -Use of uninitialized value in sort at - line 12. +Use of uninitialized value in sort at - line 22. +Use of uninitialized value in sort at - line 23. ######## use warnings 'uninitialized'; my ($m1, $m2, $v); diff --git a/t/porting/globvar.t b/t/porting/globvar.t index bc0203a..f917fd8 100644 --- a/t/porting/globvar.t +++ b/t/porting/globvar.t @@ -61,6 +61,15 @@ foreach my $file (map {$_ . $Config{_o}} qw(globals regcomp)) { close $fh or die "Problem running nm $file"; } +my $non_ieee_fp = ($Config{doublekind} == 9 || + $Config{doublekind} == 10 || + $Config{doublekind} == 11); + +if ($non_ieee_fp) { + $skip{PL_inf}++; + $skip{PL_nan}++; +} + foreach (sort keys %exported) { SKIP: { skip("We dont't export '$_' (Perl not built with this enabled?)",1) if $skip{$_}; -- Perl5 Master Repository
