summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJarkko Hietaniemi <jhi@iki.fi>2016-08-17 21:16:16 -0400
committerJarkko Hietaniemi <jhi@iki.fi>2016-08-17 22:13:38 -0400
commitb28053d1f063cb783e73b0596d1f58a21681fda6 (patch)
tree140bdff3f4ca75d24f2d62cf64b09ea9ec5d7e84
parentf40ac91c3b9891b83f3d253861009c290584b646 (diff)
downloadperl-b28053d1f063cb783e73b0596d1f58a21681fda6.tar.gz
Define Perl_fp_class() for quadmath
More importantly, define Perl_fp_class_denorm() so that hexfp subnormals work with printf %a.
-rw-r--r--perl.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/perl.h b/perl.h
index cd081eb673..b7c866a2e2 100644
--- a/perl.h
+++ b/perl.h
@@ -2022,6 +2022,12 @@ extern long double Perl_my_frexpl(long double x, int *e);
# define Perl_isinf(x) isinfq(x)
# define Perl_isnan(x) isnanq(x)
# define Perl_isfinite(x) !(isnanq(x) || isinfq(x))
+# define Perl_fp_class(x) ((x) == 0.0Q ? 0 : isinfq(x) ? 3 : isnanq(x) ? 4 : PERL_ABS(x) < FLT128_MIN ? 2 : 1)
+# define Perl_fp_class_inf(x) (Perl_fp_class(x) == 3)
+# define Perl_fp_class_nan(x) (Perl_fp_class(x) == 4)
+# define Perl_fp_class_norm(x) (Perl_fp_class(x) == 1)
+# define Perl_fp_class_denorm(x) (Perl_fp_class(x) == 2)
+# define Perl_fp_class_zero(x) (Perl_fp_class(x) == 0)
#else
# define NV_DIG DBL_DIG
# ifdef DBL_MANT_DIG