summaryrefslogtreecommitdiff
path: root/perl.h
diff options
context:
space:
mode:
authorJarkko Hietaniemi <jhi@iki.fi>2015-02-27 16:57:52 -0500
committerJarkko Hietaniemi <jhi@iki.fi>2015-06-12 09:57:23 -0400
commit68652010dea6d81e0211abf18bea20c0e046a006 (patch)
tree4080e5fd38d1387898b94dbe2f3c9d82b9800fd0 /perl.h
parent9e76e8dd3a4eeeececa2572dad4eb11d8526e286 (diff)
downloadperl-68652010dea6d81e0211abf18bea20c0e046a006.tar.gz
infnan: introduce NV_MANT_BITS
(the real bits, not including possible implicit bit)
Diffstat (limited to 'perl.h')
-rw-r--r--perl.h15
1 files changed, 15 insertions, 0 deletions
diff --git a/perl.h b/perl.h
index aa1714c99f..6e44562f9d 100644
--- a/perl.h
+++ b/perl.h
@@ -6630,6 +6630,21 @@ extern void moncontrol(int);
# endif
#endif
+/* NV_MANT_BITS is the number of _real_ mantissa bits in an NV.
+ * For the standard IEEE 754 fp this number is usually one less that
+ * *DBL_MANT_DIG because of the implicit (aka hidden) bit, which isn't
+ * real. For the 80-bit extended precision formats (x86*), the number
+ * of mantissa bits... depends. For normal floats, it's 64. But for
+ * the inf/nan, it's different (zero for inf, 61 for nan).
+ * NV_MANT_BITS works for normal floats. */
+#ifdef USE_QUADMATH /* IEEE 754 128-bit */
+# define NV_MANT_BITS (FLT128_MANT_DIG - 1)
+#elif NVSIZE == DOUBLESIZE
+# define NV_MANT_BITS DOUBLEMANTBITS
+#elif NVSIZE == LONG_DOUBLESIZE
+# define NV_MANT_BITS LONGDBLMANTBITS
+#endif
+
/*
(KEEP THIS LAST IN perl.h!)