summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJarkko Hietaniemi <jhi@iki.fi>2015-03-01 20:16:02 -0500
committerJarkko Hietaniemi <jhi@iki.fi>2015-06-12 09:57:35 -0400
commit5a14060af165c24c63cfc5d5f4d2aeb52cc41a03 (patch)
tree26db0d9bb4b48117522fb2628129bdc65007a454
parentf37aa82892bb09ff8e8c3d28b173de5d2f60d2a4 (diff)
downloadperl-5a14060af165c24c63cfc5d5f4d2aeb52cc41a03.tar.gz
infnan: move the mantbits definitions from perl.h to Configure
(this way they will be available via %Config)
-rwxr-xr-xConfigure17
-rw-r--r--Cross/config.sh-arm-linux1
-rw-r--r--NetWare/config.wc1
-rw-r--r--Porting/Glossary4
-rw-r--r--Porting/config.sh1
-rwxr-xr-xconfig_h.SH7
-rw-r--r--configure.com5
-rw-r--r--perl.h39
-rw-r--r--plan9/config_sh.sample1
-rw-r--r--symbian/config.sh1
-rw-r--r--uconfig.sh1
-rw-r--r--uconfig64.sh1
-rw-r--r--win32/config.ce1
-rw-r--r--win32/config.gc1
-rw-r--r--win32/config.vc1
15 files changed, 55 insertions, 27 deletions
diff --git a/Configure b/Configure
index d502690545..ef2243207c 100755
--- 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'
diff --git a/Cross/config.sh-arm-linux b/Cross/config.sh-arm-linux
index 544efd1f94..3d1eb4dabf 100644
--- a/Cross/config.sh-arm-linux
+++ b/Cross/config.sh-arm-linux
@@ -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'
diff --git a/NetWare/config.wc b/NetWare/config.wc
index 0e7a6826dd..e70b4dfd16 100644
--- a/NetWare/config.wc
+++ b/NetWare/config.wc
@@ -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'
diff --git a/Porting/Glossary b/Porting/Glossary
index ab63d53a0a..2cd4bb38c2 100644
--- a/Porting/Glossary
+++ b/Porting/Glossary
@@ -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.
diff --git a/Porting/config.sh b/Porting/config.sh
index 88b0b815e3..93b2a6c90e 100644
--- a/Porting/config.sh
+++ b/Porting/config.sh
@@ -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'
diff --git a/config_h.SH b/config_h.SH
index 6ae8fe2394..0701a42141 100755
--- a/config_h.SH
+++ b/config_h.SH
@@ -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
diff --git a/configure.com b/configure.com
index 6e05e90ddb..a136a77c4e 100644
--- a/configure.com
+++ b/configure.com
@@ -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 fd0a9e99d5..6fb7e3b04b 100644
--- 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
diff --git a/plan9/config_sh.sample b/plan9/config_sh.sample
index 7dce0deb06..7fd970da62 100644
--- a/plan9/config_sh.sample
+++ b/plan9/config_sh.sample
@@ -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'
diff --git a/symbian/config.sh b/symbian/config.sh
index 27f2e588af..a5aa4779a0 100644
--- a/symbian/config.sh
+++ b/symbian/config.sh
@@ -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'
diff --git a/uconfig.sh b/uconfig.sh
index 0278020ddf..bd889e30f9 100644
--- a/uconfig.sh
+++ b/uconfig.sh
@@ -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'
diff --git a/uconfig64.sh b/uconfig64.sh
index 2fefaff234..ec09c1e2f8 100644
--- a/uconfig64.sh
+++ b/uconfig64.sh
@@ -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'
diff --git a/win32/config.ce b/win32/config.ce
index 7ee16c6ef9..3c10d778d7 100644
--- a/win32/config.ce
+++ b/win32/config.ce
@@ -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'
diff --git a/win32/config.gc b/win32/config.gc
index f34d8ec4f7..e0eb2382b6 100644
--- a/win32/config.gc
+++ b/win32/config.gc
@@ -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'
diff --git a/win32/config.vc b/win32/config.vc
index 549c14097b..b4efd32b1b 100644
--- a/win32/config.vc
+++ b/win32/config.vc
@@ -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'