From: Jarkko Hietaniemi Date: Fri, 27 Feb 2015 21:57:52 +0000 (-0500) Subject: infnan: introduce NV_MANT_BITS X-Git-Tag: v5.23.0~44 X-Git-Url: https://perl5.git.perl.org/perl5.git/commitdiff_plain/68652010dea6d81e0211abf18bea20c0e046a006 infnan: introduce NV_MANT_BITS (the real bits, not including possible implicit bit) --- diff --git a/perl.h b/perl.h index aa1714c..6e44562 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!)