summary refs log tree commit diff
path: root/stdio-common
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>1999-07-14 00:54:57 +0000
committerUlrich Drepper <drepper@redhat.com>1999-07-14 00:54:57 +0000
commitabfbdde177c3a7155070dda1b2cdc8292054cc26 (patch)
treee021306b596381fbf8311d2b7eb294e918ff17c8 /stdio-common
parent86421aa57ecfd70963ae66848bd6a6dd3b8e0fe6 (diff)
downloadglibc-abfbdde177c3a7155070dda1b2cdc8292054cc26.tar.gz
glibc-abfbdde177c3a7155070dda1b2cdc8292054cc26.tar.xz
glibc-abfbdde177c3a7155070dda1b2cdc8292054cc26.zip
Update.
Diffstat (limited to 'stdio-common')
-rw-r--r--stdio-common/printf_fp.c25
1 files changed, 22 insertions, 3 deletions
diff --git a/stdio-common/printf_fp.c b/stdio-common/printf_fp.c
index 1b550abe4f..0a2efb7891 100644
--- a/stdio-common/printf_fp.c
+++ b/stdio-common/printf_fp.c
@@ -439,9 +439,28 @@ __printf_fp (FILE *fp,
 	    {
 	      if (scalesize == 0)
 		{
-		  tmpsize = powers->arraysize;
-		  memcpy (tmp, &__tens[powers->arrayoff],
-			  tmpsize * sizeof (mp_limb_t));
+#ifndef __NO_LONG_DOUBLE_MATH
+		  if (LDBL_MANT_DIG > _FPIO_CONST_OFFSET * BITS_PER_MP_LIMB
+		      && info->is_long_double)
+		    {
+#define _FPIO_CONST_SHIFT \
+  (((LDBL_MANT_DIG + BITS_PER_MP_LIMB - 1) / BITS_PER_MP_LIMB) \
+   - _FPIO_CONST_OFFSET)
+		      /* 64bit const offset is not enough for
+			 IEEE quad long double.  */
+		      tmpsize = powers->arraysize + _FPIO_CONST_SHIFT;
+		      memcpy (tmp + _FPIO_CONST_SHIFT,
+			      &__tens[powers->arrayoff],
+			      tmpsize * sizeof (mp_limb_t));
+		      MPN_ZERO (tmp, _FPIO_CONST_SHIFT);
+		    }
+		  else
+#endif
+		    {
+		      tmpsize = powers->arraysize;
+		      memcpy (tmp, &__tens[powers->arrayoff],
+			      tmpsize * sizeof (mp_limb_t));
+		    }
 		}
 	      else
 		{