summaryrefslogtreecommitdiff
path: root/sv.c
diff options
context:
space:
mode:
authorJarkko Hietaniemi <jhi@iki.fi>2014-10-07 08:35:04 +0200
committerJarkko Hietaniemi <jhi@iki.fi>2014-10-07 20:16:46 +0200
commit4d3fd3a9525136c14b17e44b6d97747b4be7a96a (patch)
treefeb13fa97e84620b3fc5d58b5b3731335f976003 /sv.c
parent59206727b78ef2c3c1f5b83c0a4d9a24a867c5da (diff)
downloadperl-4d3fd3a9525136c14b17e44b6d97747b4be7a96a.tar.gz
The double-double precision can be really large.
I don't know where I had pulled the earlier smaller limit, but sisyphus@ set me right.
Diffstat (limited to 'sv.c')
-rw-r--r--sv.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/sv.c b/sv.c
index 195250062a..b2dcc91d85 100644
--- a/sv.c
+++ b/sv.c
@@ -10714,12 +10714,16 @@ Perl_sv_vcatpvfn(pTHX_ SV *const sv, const char *const pat, const STRLEN patlen,
#if LONG_DOUBLEKIND == LONG_DOUBLE_IS_DOUBLEDOUBLE_128_BIT_LITTLE_ENDIAN || \
LONG_DOUBLEKIND == LONG_DOUBLE_IS_DOUBLEDOUBLE_128_BIT_BIG_ENDIAN
# define LONGDOUBLE_DOUBLEDOUBLE
-# define DOUBLEDOUBLE_MAXBITS 1028
+/* The first double can be as large as 2**1023, or '1' x '0' x 1023.
+ * The second double can be as small as 2**-1074, or '0' x 1073 . '1'.
+ * The sum of them can be '1' . '0' x 2096 . '1', with implied radix point
+ * after the first 1023 zero bits. */
+# define DOUBLEDOUBLE_MAXBITS 2098
#endif
/* vhex will contain the values (0..15) of the hex digits ("nybbles"
* of 4 bits); 1 for the implicit 1, and the mantissa bits, four bits
- * per xdigit. */
+ * per xdigit. For the double-double case, this can be rather many. */
#ifdef LONGDOUBLE_DOUBLEDOUBLE
# define VHEX_SIZE (1+DOUBLEDOUBLE_MAXBITS/4)
#else
@@ -11960,7 +11964,8 @@ Perl_sv_vcatpvfn_flags(pTHX_ SV *const sv, const char *const pat, const STRLEN p
* Since each double has their own exponent, the
* doubles may float (haha) rather far from each
* other, and the number of required bits is much
- * larger, up to total of 1028 bits.
+ * larger, up to total of DOUBLEDOUBLE_MAXBITS bits.
+ * See the definition of DOUBLEDOUBLE_MAXBITS.
*
* Need 2 hexdigits for each byte. */
need += (DOUBLEDOUBLE_MAXBITS/8 + 1) * 2;