This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Perl_isfinitel should not use the fpclass macross blindly.
authorJarkko Hietaniemi <jhi@iki.fi>
Fri, 12 Sep 2014 11:01:41 +0000 (07:01 -0400)
committerJarkko Hietaniemi <jhi@iki.fi>
Fri, 12 Sep 2014 11:26:06 +0000 (07:26 -0400)
(Whether the macros are safe for long doubles, is complicated.)

perl.h

diff --git a/perl.h b/perl.h
index ff01e4f..39bf241 100644 (file)
--- a/perl.h
+++ b/perl.h
@@ -2312,10 +2312,10 @@ 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)
 #    endif
 #endif