This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Partial revert of c6d2504a: do not use isfinite().
authorJarkko Hietaniemi <jhi@iki.fi>
Thu, 21 Aug 2014 19:04:47 +0000 (15:04 -0400)
committerJarkko Hietaniemi <jhi@iki.fi>
Thu, 21 Aug 2014 19:09:15 +0000 (15:09 -0400)
Instead return to a well-defined hack that has served us for years.

Immediate reason: VMS.  It has isfinite(), but due to messy
reasons it doesn't currently get the prototype.

sv.c

diff --git a/sv.c b/sv.c
index d295f64..288a1e8 100644 (file)
--- a/sv.c
+++ b/sv.c
@@ -11695,9 +11695,11 @@ Perl_sv_vcatpvfn_flags(pTHX_ SV *const sv, const char *const pat, const STRLEN p
                : SvNV(argsv);
 
            need = 0;
-           /* frexp() has some unspecified behaviour for nan/inf,
-             * so let's avoid calling that. */
-           if (c != 'e' && c != 'E' && Perl_isfinite(nv)) {
+           /* frexp() (or frexpl) has some unspecified behaviour for
+             * nan/inf/-inf, so let's avoid calling that on those
+             * three values. nv * 0 will be NaN for NaN, +Inf and -Inf,
+             * and 0 for anything else. */
+           if (c != 'e' && c != 'E' && (nv * 0) == 0) {
                 i = PERL_INT_MIN;
                 (void)Perl_frexp(nv, &i);
                 if (i == PERL_INT_MIN)