summaryrefslogtreecommitdiff
path: root/stdio-common/printf_fp.c
diff options
context:
space:
mode:
Diffstat (limited to 'stdio-common/printf_fp.c')
-rw-r--r--stdio-common/printf_fp.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/stdio-common/printf_fp.c b/stdio-common/printf_fp.c
index 62867e75f2..ed225e05a6 100644
--- a/stdio-common/printf_fp.c
+++ b/stdio-common/printf_fp.c
@@ -430,7 +430,9 @@ __printf_fp (FILE *fp,
would be really big it could lead to memory problems. */
{
mp_size_t bignum_size = ((ABS (exponent) + BITS_PER_MP_LIMB - 1)
- / BITS_PER_MP_LIMB + 4) * sizeof (mp_limb_t);
+ / BITS_PER_MP_LIMB
+ + (LDBL_MANT_DIG / BITS_PER_MP_LIMB > 2 ? 8 : 4))
+ * sizeof (mp_limb_t);
frac = (mp_limb_t *) alloca (bignum_size);
tmp = (mp_limb_t *) alloca (bignum_size);
scale = (mp_limb_t *) alloca (bignum_size);