In perl.git, the branch blead has been updated

<http://perl5.git.perl.org/perl.git/commitdiff/9267464d98c4b9588c96a4fff7202bbe3b09f9a8?hp=d3bd9faeb630a8d4cafd65f4110cbba585a82907>

- Log -----------------------------------------------------------------
commit 9267464d98c4b9588c96a4fff7202bbe3b09f9a8
Author: Jarkko Hietaniemi <[email protected]>
Date:   Fri Sep 12 07:17:01 2014 -0400

    Comment tweak for HAS_C99.

M       perl.h

commit 99bf9e32fc57a4be2b3d9395384dc7bf2dc9d8e7
Author: Jarkko Hietaniemi <[email protected]>
Date:   Fri Sep 12 07:24:15 2014 -0400

    Use the multiplication test instead of the DBL_MAX/LDBL_MAX.
    
    Comparing to decimal float constants feels unclean.

M       perl.h

commit 16334e6ed27593bc12382ef6095c56bc202a11d2
Author: Jarkko Hietaniemi <[email protected]>
Date:   Fri Sep 12 07:01:41 2014 -0400

    Perl_isfinitel should not use the fpclass macross blindly.
    
    (Whether the macros are safe for long doubles, is complicated.)

M       perl.h
-----------------------------------------------------------------------

Summary of changes:
 perl.h | 19 ++++++++++++-------
 1 file changed, 12 insertions(+), 7 deletions(-)

diff --git a/perl.h b/perl.h
index ff01e4f..29c739b 100644
--- a/perl.h
+++ b/perl.h
@@ -28,7 +28,11 @@
 #   include "config.h"
 #endif
 
-#if (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L) || 
defined(_STDC_C99)
+/* Note that with gcc -std=c89 the __STDC_VERSION__ is *not* defined
+ * because the __STDC_VERSION__ became a thing only with C90.  Therefore,
+ * with gcc, HAS_C99 will never become true as long as we use -std=c89. */
+#if (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L) || \
+     defined(_STDC_C99)
 #  define HAS_C99 1
 #endif
 
@@ -2023,8 +2027,11 @@ EXTERN_C long double modfl(long double, long double *);
 #       define Perl_isfinite(x) isfinite(x)
 #     elif defined(HAS_FINITE)
 #       define Perl_isfinite(x) finite(x)
-#     elif defined(DBL_MAX)
-#       define Perl_isfinite(x) ((x) <= DBL_MAX && (x) >= -DBL_MAX)
+#     else
+/* For the infinities the multiplication returns nan,
+ * for the nan the multiplication also returns nan,
+ * for everything else (that is, finite) zero should be returned. */
+#       define Perl_isfinite(x) ((x) * 0 == 0)
 #     endif
 #   endif
 #endif
@@ -2312,10 +2319,8 @@ int isnan(double d);
 #        define Perl_isfinitel(x) finitel(x)
 #    elif defined(HAS_INFL) && defined(HAS_NANL)
 #        define Perl_isfinitel(x) !(isinfl(x)||isnanl(x))
-#    elif defined(Perl_fp_class_inf) && defined(Perl_fp_class_nan)
-#        define Perl_isfinitel(x) !(Perl_fp_class_inf(x)||Perl_fp_class_nan(x))
-#    elif defined(LDBL_MAX)
-#        define Perl_isfinitel(x) ((x) <= LDBL_MAX && (x) >= -LDBL_MAX)
+#    else
+#        define Perl_isfinitel(x) ((x) * 0 == 0)  /* See Perl_isfinite. */
 #    endif
 #endif
 

--
Perl5 Master Repository

Reply via email to