This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
infnan: move the mantbits definitions from perl.h to Configure
authorJarkko Hietaniemi <jhi@iki.fi>
Mon, 2 Mar 2015 01:16:02 +0000 (20:16 -0500)
committerJarkko Hietaniemi <jhi@iki.fi>
Fri, 12 Jun 2015 13:57:35 +0000 (09:57 -0400)
(this way they will be available via %Config)

15 files changed:
Configure
Cross/config.sh-arm-linux
NetWare/config.wc
Porting/Glossary
Porting/config.sh
config_h.SH
configure.com
perl.h
plan9/config_sh.sample
symbian/config.sh
uconfig.sh
uconfig64.sh
win32/config.ce
win32/config.gc
win32/config.vc

index d502690..ef22432 100755 (executable)
--- a/Configure
+++ b/Configure
@@ -1180,6 +1180,7 @@ ivsize=''
 ivtype=''
 nv_overflows_integers_at=''
 nv_preserves_uv_bits=''
+nvmantbits=''
 nvsize=''
 nvtype=''
 u16size=''
@@ -18834,6 +18835,21 @@ else
 fi
 $rm_try
 
+$echo "Checking how many mantissa bits your NVs have..." >&4
+if test "X$usequadmath" = "X$define"; then
+  nvmantbits=112 # 128-1-15
+else
+  if test "X$nvsize" = "X$doublesize"; then
+    nvmantbits="$doublemantbits"
+  else
+     if test "X$nvsize" = "X$longdblsize"; then
+       nvmantbits="$longdblmantbits"
+     else
+       nvmantbits="$undef"
+     fi
+  fi
+fi
+
 : see if sigprocmask exists
 set sigprocmask d_sigprocmask
 eval $inlibc
@@ -24840,6 +24856,7 @@ nv_preserves_uv_bits='$nv_preserves_uv_bits'
 nveformat='$nveformat'
 nvfformat='$nvfformat'
 nvgformat='$nvgformat'
+nvmantbits='$nvmantbits'
 nvsize='$nvsize'
 nvtype='$nvtype'
 o_nonblock='$o_nonblock'
index 544efd1..3d1eb4d 100644 (file)
@@ -913,6 +913,7 @@ nv_preserves_uv_bits='32'
 nveformat='"e"'
 nvfformat='"f"'
 nvgformat='"g"'
+nvmantbits='52'
 nvsize='8'
 nvtype='double'
 o_nonblock='O_NONBLOCK'
index 0e7a682..e70b4df 100644 (file)
@@ -888,6 +888,7 @@ nv_preserves_uv_bits='32'
 nveformat='"e"'
 nvfformat='"f"'
 nvgformat='"g"'
+nvmantbits='52'
 nvsize='8'
 nvtype='double'
 o_nonblock='O_NONBLOCK'
index ab63d53..2cd4bb3 100644 (file)
@@ -4382,6 +4382,10 @@ nvGUformat (perlxvf.U):
        This variable contains the format string used for printing
        a Perl NV using %G-ish floating point format.
 
+nvmantbits (mantbits.U):
+       This variable tells how many bits the mantissa of a Perl NV has,
+       not including the possible implicit bit.
+
 nvsize (perlxv.U):
        This variable is the size of a Perl NV in bytes.
        Note that some floating point formats have unused bytes.
index 88b0b81..93b2a6c 100644 (file)
@@ -931,6 +931,7 @@ nv_preserves_uv_bits='53'
 nveformat='"e"'
 nvfformat='"f"'
 nvgformat='"g"'
+nvmantbits='52'
 nvsize='8'
 nvtype='double'
 o_nonblock='O_NONBLOCK'
index 6ae8fe2..0701a42 100755 (executable)
@@ -4877,6 +4877,13 @@ sed <<!GROK!THIS! >$CONFIG_H -e 's!^#undef\(.*/\)\*!/\*#define\1 \*!' -e 's!^#un
  */
 #define LONGDBLMANTBITS $longdblmantbits
 
+/* NVMANTBITS:
+ *     This symbol, if defined, tells how many mantissa bits
+ *     (not including implicit bit) there are in a Perl NV.
+ *     This depends on which floating point type was chosen.
+ */
+#define NVMANTBITS $nvmantbits         /**/
+
 /* NEED_VA_COPY:
  *     This symbol, if defined, indicates that the system stores
  *     the variable argument list datatype, va_list, in a format
index 6e05e90..a136a77 100644 (file)
@@ -5579,6 +5579,9 @@ $ doublemantbits = "52"
 $ IF uselongdouble .OR. uselongdouble .EQS. "define"
 $ THEN
 $   nvtype="long double"
+$   nvmantbits = longdblmantbits
+$ ELSE
+$   nvmantbits = doublemantbits
 $ ENDIF
 $!
 $ tmp = "''ivtype'"
@@ -6660,6 +6663,7 @@ $ WC "longdblsize='" + longdblsize + "'"
 $ WC "longdblkind='" + longdblkind + "'"
 $ WC "longdblinfbytes='" + longdblinfbytes + "'"
 $ WC "longdblnanbytes='" + longdblnanbytes + "'"
+$ WC "longdblmantbits='" + longdblmantbits + "'"
 $ WC "longlongsize='" + longlongsize + "'"
 $ WC "longsize='" + longsize + "'"
 $ IF uselargefiles .OR. uselargefiles .EQS. "define"
@@ -6695,6 +6699,7 @@ $ WC "nvfformat='" + nvfformat + "'"
 $ WC "nvFUformat='" + nvFUformat + "'"
 $ WC "nvgformat='" + nvgformat + "'"
 $ WC "nvGUformat='" + nvGUformat + "'"
+$ WC "nvmantbits='" + nvmantbits + "'"
 $ WC "nvsize='" + nvsize + "'"
 $ WC "nvtype='" + nvtype + "'"
 $ WC "o_nonblock=' '"
diff --git a/perl.h b/perl.h
index fd0a9e9..6fb7e3b 100644 (file)
--- a/perl.h
+++ b/perl.h
@@ -6630,21 +6630,6 @@ 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
-
 /* NaNs (not-a-numbers) can carry payload bits, in addition to
  * "nan-ness".  Part of the payload is the quiet/signaling bit.
  * To back up a bit (harhar):
@@ -6691,15 +6676,16 @@ extern void moncontrol(int);
  * This means that in this format there are 61 bits available
  * for the nan payload.
  *
- * NV_NAN_PAYLOAD_BITS tells how many bits there are available for
- * the nan payload, *not* including the quiet/signaling bit. */
-#if defined(USE_LONG_DOUBLE) && NVSIZE > DOUBLESIZE && \
-    (LONG_DOUBLEKIND == LONG_DOUBLE_IS_X86_80_BIT_LITTLE_ENDIAN || \
-     LONG_DOUBLEKIND == LONG_DOUBLE_IS_X86_80_BIT_BIG_ENDIAN)
-#  define NV_NAN_PAYLOAD_BITS 61
-#else
-#  define NV_NAN_PAYLOAD_BITS (NV_MANT_BITS - 1)
-#endif
+ * NVMANTBITS 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).
+ * NVMANTBITS works for normal floats. */
+
+/* We do not want to include the quiet/signaling bit. */
+#define NV_NAN_BITS (NVMANTBITS - 1)
 
 #if defined(USE_LONG_DOUBLE) && NVSIZE > DOUBLESIZE
 #  if LONG_DOUBLEKIND == LONG_DOUBLE_IS_IEEE_754_128_BIT_LITTLE_ENDIAN
@@ -6757,10 +6743,9 @@ extern void moncontrol(int);
 #elif defined(USE_LONG_DOUBLE) && \
   (LONG_DOUBLEKIND == LONG_DOUBLE_IS_DOUBLEDOUBLE_128_BIT_LITTLE_ENDIAN || \
    LONG_DOUBLEKIND == LONG_DOUBLE_IS_DOUBLEDOUBLE_128_BIT_BIG_ENDIAN)
-#  define NV_NAN_QS_BIT_SHIFT 3 /* 0x08, but not via NV_NAN_PAYLOAD_BITS */
+#  define NV_NAN_QS_BIT_SHIFT 3 /* 0x08, but not via NV_NAN_BITS */
 #else
-#  define NV_NAN_QS_BIT_SHIFT \
-    ((NV_NAN_PAYLOAD_BITS) % 8) /* usually 3, or 0x08 */
+#  define NV_NAN_QS_BIT_SHIFT ((NV_NAN_BITS) % 8) /* usually 3, or 0x08 */
 #endif
 #define NV_NAN_QS_BIT (1 << (NV_NAN_QS_BIT_SHIFT))
 /* NV_NAN_QS_BIT_OFFSET is the bit offset from the beginning of a NV
index 7dce0de..7fd970d 100644 (file)
@@ -894,6 +894,7 @@ nv_preserves_uv_bits='31'
 nveformat='"e"'
 nvfformat='"f"'
 nvgformat='"g"'
+nvmantbits='52'
 nvsize='8'
 nvtype='double'
 o_nonblock='O_NONBLOCK'
index 27f2e58..a5aa477 100644 (file)
@@ -763,6 +763,7 @@ nv_preserves_uv_bits='0'
 nveformat='"e"'
 nvfformat='"f"'
 nvgformat='"g"'
+nvmantbits='52'
 nvsize='8'
 nvtype='double'
 o_nonblock='O_NONBLOCK'
index 0278020..bd889e3 100644 (file)
@@ -737,6 +737,7 @@ nv_preserves_uv_bits='0'
 nveformat='"e"'
 nvfformat='"f"'
 nvgformat='"g"'
+nvmantbits='52'
 nvsize='8'
 nvtype='double'
 o_nonblock='O_NONBLOCK'
index 2fefaff..ec09c1e 100644 (file)
@@ -738,6 +738,7 @@ nv_preserves_uv_bits='0'
 nveformat='"e"'
 nvfformat='"f"'
 nvgformat='"g"'
+nvmantbits='52'
 nvsize='8'
 nvtype='double'
 o_nonblock='O_NONBLOCK'
index 7ee16c6..3c10d77 100644 (file)
@@ -877,6 +877,7 @@ nv_preserves_uv_bits='32'
 nveformat='"e"'
 nvfformat='"f"'
 nvgformat='"g"'
+nvmantbits='52'
 nvsize='8'
 nvtype='double'
 o_nonblock='O_NONBLOCK'
index f34d8ec..e0eb238 100644 (file)
@@ -906,6 +906,7 @@ nv_preserves_uv_bits='32'
 nveformat='"e"'
 nvfformat='"f"'
 nvgformat='"g"'
+nvmantbits='52'
 nvsize='8'
 nvtype='double'
 o_nonblock='O_NONBLOCK'
index 549c140..b4efd32 100644 (file)
@@ -905,6 +905,7 @@ nv_preserves_uv_bits='32'
 nveformat='"e"'
 nvfformat='"f"'
 nvgformat='"g"'
+nvmantbits='52'
 nvsize='8'
 nvtype='double'
 o_nonblock='O_NONBLOCK'