2012-11-18  David S. Miller  <davem@davemloft.net>
	    Tobias Burnus  <burnus@net-b.de>

	* math/log1pq.c (log1pq): Update from GLIBC. Saturate
        nonzero exponents with absolute value below 0x1p-128 to +/-
        0x1p-128.
	* math/powq.c (powq): Update from GLIBC. If xm1 is
        smaller than LDBL_EPSILON/2.0L, just return xm1.

2012-11-18  Tobias Burnus  <burnus@net-b.de>
	    Joseph Myers  <joseph@codesourcery.com>

	* configure.ac (AC_CHECK_HEADERS): Check for fpu_control.h.
	(HAVE_HOST_CPU_X86, HAVE_HOST_CPU_IA64): New defines.
	* config.h.in: Regenerate.
	* configure: Regenerate.
	* quadmath-imp.h (TININESS_AFTER_ROUNDING) Moved to
	quadmath-rounding-mode.h.
	* quadmath-rounding-mode.h: New.
	* quadmath-generic-rounding-mode.h: New.
	* quadmath-ia64-rounding-mode.h: New.
	* quadmath-x64-fpu_control.h: New.
	* math/fmaq.c: Include quadmath-rounding-mode.h.
	* printf/fpioconst.c: Update from GLIBC. Fix strtod rounding.
	* printf/fpioconst.h: Ditto.
	* printf/printf_fp.c (__quadmath_printf_fp): Update from GLIBC.
	Make printf respect the rounding mode for decimal output.
	* printf/printf_fphex.c (__quadmath_printf_fphex): Update from
	GLIBC.  Make printf respect the rounding mode for hex output.
	* strtod/strtod_l.c: Update from GLIBC. Make strtod respect the
	rounding mode. Fix strtod handling of underflow.


diff --git a/libquadmath/config.h.in b/libquadmath/config.h.in
index ea3f10c..5ba7cc2 100644
--- a/libquadmath/config.h.in
+++ b/libquadmath/config.h.in
@@ -30,9 +30,18 @@
 /* libm includes feupdateenv */
 #undef HAVE_FEUPDATEENV
 
+/* Define to 1 if you have the <fpu_control.h> header file. */
+#undef HAVE_FPU_CONTROL_H
+
 /* __attribute__((visibility ("hidden"))) supported */
 #undef HAVE_HIDDEN_VISIBILITY
 
+/* Define if the host sytem has a IA64 CPU. */
+#undef HAVE_HOST_CPU_IA64
+
+/* Define if the host sytem has a i?86 or x86_64 CPU. */
+#undef HAVE_HOST_CPU_X86
+
 /* Define to 1 if you have the <inttypes.h> header file. */
 #undef HAVE_INTTYPES_H
 
diff --git a/libquadmath/configure b/libquadmath/configure
index 1677671..07e7ac2 100755
--- a/libquadmath/configure
+++ b/libquadmath/configure
@@ -11932,7 +11932,8 @@ esac
 
 
 
-for ac_header in fenv.h langinfo.h locale.h wchar.h wctype.h limits.h ctype.h printf.h errno.h
+for ac_header in fenv.h langinfo.h locale.h wchar.h wctype.h limits.h ctype.h \
+		 printf.h errno.h fpu_control.h
 do :
   as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
 ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default"
@@ -11947,6 +11948,24 @@ fi
 done
 
 
+#
+# To determine the current rounding mode, either the system's fpu_control.h
+# is used or CPU-specific code.
+#
+case "$host_cpu" in
+  i3456786 | x86_64)
+
+$as_echo "#define HAVE_HOST_CPU_X86 1" >>confdefs.h
+
+    ;;
+  ia64)
+
+$as_echo "#define HAVE_HOST_CPU_IA64 1" >>confdefs.h
+
+    ;;
+esac
+
+
 # If available, sqrtl and cbrtl speed up the calculation -
 # but they are not required
 if test x$gcc_no_link != xyes; then
diff --git a/libquadmath/configure.ac b/libquadmath/configure.ac
index d3bfb04..fb49ba1 100644
--- a/libquadmath/configure.ac
+++ b/libquadmath/configure.ac
@@ -112,7 +112,24 @@ esac
 AC_SUBST(toolexecdir)
 AC_SUBST(toolexeclibdir)
 
-AC_CHECK_HEADERS(fenv.h langinfo.h locale.h wchar.h wctype.h limits.h ctype.h printf.h errno.h)
+AC_CHECK_HEADERS(fenv.h langinfo.h locale.h wchar.h wctype.h limits.h ctype.h \
+		 printf.h errno.h fpu_control.h)
+
+#
+# To determine the current rounding mode, either the system's fpu_control.h
+# is used or CPU-specific code.
+#
+case "$host_cpu" in
+  i[34567]86 | x86_64)
+    AC_DEFINE(HAVE_HOST_CPU_X86, 1,
+        Define if the host sytem has a i?86 or x86_64 CPU.)
+    ;;
+  ia64)
+    AC_DEFINE(HAVE_HOST_CPU_IA64, 1,
+        Define if the host sytem has a IA64 CPU.)
+    ;;
+esac
+
 
 # If available, sqrtl and cbrtl speed up the calculation -
 # but they are not required
diff --git a/libquadmath/math/fmaq.c b/libquadmath/math/fmaq.c
index fa3b3ea..02d1705 100644
--- a/libquadmath/math/fmaq.c
+++ b/libquadmath/math/fmaq.c
@@ -18,6 +18,7 @@
    <http://www.gnu.org/licenses/>.  */
 
 #include "quadmath-imp.h"
+#include "quadmath-rounding-mode.h"
 #include <math.h>
 #include <float.h>
 #ifdef HAVE_FENV_H
diff --git a/libquadmath/math/log1pq.c b/libquadmath/math/log1pq.c
index 2de13fe..d8bff40 100644
--- a/libquadmath/math/log1pq.c
+++ b/libquadmath/math/log1pq.c
@@ -136,6 +136,12 @@ log1pq (__float128 xm1)
       && (u.words32.w1 | u.words32.w2 | u.words32.w3) == 0)
     return xm1;
 
+  if ((hx & 0x7fffffff) < 0x3f8e0000)
+    {
+      if ((int) xm1 == 0)
+       return xm1;
+    }
+
   x = xm1 + 1.0Q;
 
   /* log1p(-1) = -inf */
diff --git a/libquadmath/math/powq.c b/libquadmath/math/powq.c
index 12b87d5..dd44b7c 100644
--- a/libquadmath/math/powq.c
+++ b/libquadmath/math/powq.c
@@ -148,7 +148,7 @@ powq (__float128 x, __float128 y)
 {
   __float128 z, ax, z_h, z_l, p_h, p_l;
   __float128 y1, t1, t2, r, s, t, u, v, w;
-  __float128 s2, s_h, s_l, t_h, t_l;
+  __float128 s2, s_h, s_l, t_h, t_l, ay;
   int32_t i, j, k, yisint, n;
   uint32_t ix, iy;
   int32_t hx, hy;
@@ -281,6 +281,10 @@ powq (__float128 x, __float128 y)
 	return (hy > 0) ? huge * huge : tiny * tiny;
     }
 
+  ay = y > 0 ? y : -y;
+  if (ay < 0x1p-128)
+    y = y < 0 ? -0x1p-128 : 0x1p-128;
+
   n = 0;
   /* take care subnormal number */
   if (ix < 0x00010000)
diff --git a/libquadmath/printf/fpioconst.c b/libquadmath/printf/fpioconst.c
index 8c67e6f..cacb144 100644
--- a/libquadmath/printf/fpioconst.c
+++ b/libquadmath/printf/fpioconst.c
@@ -14,9 +14,8 @@
    Lesser General Public License for more details.
 
    You should have received a copy of the GNU Lesser General Public
-   License along with the GNU C Library; if not, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
+   License along with the GNU C Library; if not, see
+   <http://www.gnu.org/licenses/>.  */
 
 #include <config.h>
 #include "gmp-impl.h"		/* This defines BITS_PER_MP_LIMB.  */
@@ -77,9 +76,8 @@ const mp_limb_t __tens[] =
   0x26b2716e, 0xadc666b0, 0x1d153624, 0x3c42d35a, 0x63ff540e, 0xcc5573c0,
   0x65f9ef17, 0x55bc28f2, 0x80dcc7f7, 0xf46eeddc, 0x5fdcefce, 0x000553f7,
 
-#ifndef __NO_LONG_DOUBLE_MATH
-# define TENS_P9_IDX	(TENS_P8_IDX + TENS_P8_SIZE)
-# define TENS_P9_SIZE	56
+#define TENS_P9_IDX	(TENS_P8_IDX + TENS_P8_SIZE)
+#define TENS_P9_SIZE	56
   [TENS_P9_IDX] = 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
   0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
   0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
@@ -91,8 +89,8 @@ const mp_limb_t __tens[] =
   0xb099bc81, 0x45a71d46, 0xa2699748, 0x8cb07303, 0x8a0b1f13, 0x8cab8a97,
   0xc1d238d9, 0x633415d4, 0x0000001c,
 
-# define TENS_P10_IDX	(TENS_P9_IDX + TENS_P9_SIZE)
-# define TENS_P10_SIZE	109
+#define TENS_P10_IDX	(TENS_P9_IDX + TENS_P9_SIZE)
+#define TENS_P10_SIZE	109
   [TENS_P10_IDX] = 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
   0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
   0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
@@ -113,6 +111,7 @@ const mp_limb_t __tens[] =
   0xd2db49ef, 0x926c3f5b, 0xae6209d4, 0x2d433949, 0x34f4a3c6, 0xd4305d94,
   0xd9d61a05, 0x00000325,
 
+#ifndef __NO_LONG_DOUBLE_MATH
 # define TENS_P11_IDX	(TENS_P10_IDX + TENS_P10_SIZE)
 # define TENS_P11_SIZE	215
   [TENS_P11_IDX] = 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
@@ -225,9 +224,442 @@ const mp_limb_t __tens[] =
   0x35fcb457, 0x1bb6c6e4, 0xf74eb928, 0x3d5d0b54, 0x87cc1d21, 0x4964046f,
   0x18ae4240, 0xd868b275, 0x8bd2b496, 0x1c5563f4, 0xc234d8f5, 0xf868e970,
   0xf9151fff, 0xae7be4a2, 0x271133ee, 0xbb0fd922, 0x25254932, 0xa60a9fc0,
-  0x104bcd64, 0x30290145, 0x00000062
-#endif	/* !__NO_LONG_DOUBLE_MATH */
+  0x104bcd64, 0x30290145, 0x00000062,
+
+# define TENS_P13_IDX	(TENS_P12_IDX + TENS_P12_SIZE)
+# define TENS_P13_SIZE	853
+  [TENS_P13_IDX] = 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+  0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+  0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+  0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+  0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+  0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+  0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+  0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+  0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+  0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+  0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+  0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+  0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+  0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+  0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+  0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+  0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+  0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+  0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+  0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+  0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+  0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+  0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+  0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+  0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+  0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+  0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+  0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+  0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+  0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+  0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+  0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+  0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+  0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+  0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+  0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+  0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+  0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+  0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+  0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+  0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+  0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+  0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+  0x00000000, 0x64cf8001, 0x9f345226, 0x644963e5, 0x7b8d5053, 0x49f0aa29,
+  0xb945c82f, 0x430ff478, 0x933b6bb8, 0x5ff82d0a, 0x64c501d4, 0x73bbf174,
+  0x9ec1e1b3, 0x3bfbe803, 0xe9010689, 0xf7390d8e, 0x3fef8d80, 0xf31d1325,
+  0x2c73446b, 0xf5ca7a92, 0x1c19e379, 0x270af2be, 0xf52d9d9c, 0xeb2bed48,
+  0x3abf72e1, 0x4ac4ffc2, 0x7ecf3508, 0x22019a82, 0x38597a5a, 0xbe6a7b3c,
+  0x9a51ff6e, 0xa2d28437, 0x0c0abe9d, 0x7c9ec6ea, 0xc79887ff, 0x5851c899,
+  0x436420d0, 0xefead581, 0x72b5547f, 0x99b1d2b5, 0x077ad8f8, 0x5cddbf5b,
+  0x3b4305ed, 0xe3861ac7, 0x2d88f3fd, 0x3d6b43be, 0x393220aa, 0xe5382405,
+  0x1cd62095, 0x61a10c96, 0x87a0d1e1, 0xca95a55d, 0x68c933e6, 0x9ee082e2,
+  0x778089bb, 0x41429ee9, 0xfbb6d8d4, 0xc529500d, 0x26cf5471, 0x68b9be29,
+  0xd6c9b140, 0x07be635a, 0x84151852, 0xb5572182, 0x83730335, 0xeb2300b4,
+  0xdd312d31, 0x05d6dd9b, 0x488da59c, 0x37784d25, 0xda2c2e40, 0x6a8d92fa,
+  0x6a57d720, 0x950b41ac, 0xf07a8632, 0xcd55f062, 0x2ecad06a, 0xe6a3dfe7,
+  0x34c98bb0, 0x9c767d8f, 0xb60521b1, 0x752aafd1, 0xe87d16be, 0x9de1d728,
+  0xe58a8b0c, 0xc6013830, 0x2fa2c119, 0x3c4f9156, 0x519b40c8, 0x5058fc8f,
+  0xab78701b, 0xadc59c47, 0xc502a554, 0x0fb3286f, 0x6647f04c, 0x9db4076e,
+  0x5ea495c8, 0x9c74fab1, 0xb4f00f8b, 0x897c7a3c, 0xd092b4c6, 0x283e0340,
+  0x32f31fa8, 0xeeb708cc, 0x67b63de2, 0x4f7b3c8b, 0xef2bc02b, 0xda14bfe3,
+  0xc49344c0, 0xaabc85be, 0xb6c4e69e, 0x2ece8aa6, 0x63a11016, 0x19cfba4d,
+  0x726ae4d9, 0x0fc90b42, 0xee6ae707, 0x4290b04a, 0x4d9aabc5, 0xfb2b070e,
+  0xf34906cd, 0x1ff54b0a, 0x52ca9709, 0x0b42bfe1, 0x16431570, 0x980f3076,
+  0x6b5565bb, 0xeb8c4c4a, 0x9ce63c76, 0xb9e4c771, 0x3da24c53, 0x6f0266fa,
+  0xb50e3c66, 0x76e34f79, 0x01bb4b96, 0x9948cf3e, 0x0fbea124, 0x86bead12,
+  0xa1fa4edc, 0xd11e901c, 0xc3b97bf9, 0x71730e03, 0x370ca58e, 0x48b19715,
+  0x886467e2, 0xdb237497, 0x3c727e24, 0x2116ccd2, 0x8e67d76e, 0xf973aecf,
+  0x34bdedd3, 0x31d680ec, 0xb042ab05, 0x770e96a0, 0xfc5c3c17, 0xab6f1874,
+  0xb8204ece, 0x5843f3a5, 0x416c0ced, 0x11dd112f, 0x95780183, 0xb1c74bd8,
+  0x7e0e8613, 0x96c6453b, 0xa79ffc10, 0xb2157651, 0xfcd6da0a, 0x836a34a7,
+  0x3dd0ccac, 0x316e5a36, 0x496049ed, 0x0322bcb2, 0xdea1a97d, 0xcdf2aa5a,
+  0x39578d53, 0x1d1aa931, 0x030565c9, 0xd198cbed, 0x324e0a27, 0x5db83e8a,
+  0x28432534, 0x90bf23e8, 0x5cb134c0, 0xdd0adab6, 0x009e5051, 0xf8ad61da,
+  0x7e36a6d7, 0x84c75e57, 0xbdffe6aa, 0xb5d5532e, 0x138d680e, 0xbd84ddac,
+  0x4a5f74a1, 0xccff00d1, 0x55538cfa, 0xb0948b8c, 0x48528011, 0xe345f82e,
+  0x9e047ad7, 0x6ee770ff, 0xea77bef0, 0x0fc13669, 0x2f162567, 0x869426ac,
+  0x0614686c, 0x3a3ff464, 0x4263ed82, 0xb3589b47, 0x57205a7a, 0x213f24ad,
+  0xae6fc46b, 0x3de03e4e, 0xd92b133f, 0x315a589b, 0x1b49c24a, 0x73381bcb,
+  0x1641c138, 0x7bc99425, 0xbc680ada, 0xa5cfbc9a, 0x962e9884, 0x0a960d70,
+  0xfc8d12f6, 0xed18ef4c, 0x60acc868, 0x9aea5d14, 0x13113036, 0xc747c87e,
+  0x2d99a5b0, 0x3a369bb3, 0x006b3658, 0x118a5135, 0xe43fa6e6, 0xb4947190,
+  0xa13dc05e, 0xd7733db8, 0x0dbd7170, 0xc3fb67d1, 0x117ed7e7, 0xe2d72a49,
+  0xc05fe99e, 0x9638db40, 0xd971a25b, 0x4239d468, 0x1a159559, 0x850a223c,
+  0xc1117392, 0x22d2dbd8, 0x567b5fc0, 0x92c5b4eb, 0xc051007a, 0x11cc0099,
+  0xfb355720, 0x6907810d, 0x39848161, 0x5e8534f4, 0x61d19ef2, 0x2ee8c466,
+  0x8a0ab03c, 0xc234af76, 0x879aa514, 0x9774a235, 0x59e5da57, 0x9bc466b3,
+  0xf339bd5a, 0x44ab026d, 0xbbb5fd67, 0x2b977202, 0x3685c9f2, 0x03e5dc00,
+  0x7054359e, 0x5239cfb0, 0x9ba11f08, 0xf8237562, 0x9c258687, 0xa3b510dd,
+  0x52c7bf8f, 0xb31ed0cf, 0x3245e079, 0xff9ff8d3, 0xbaee38c7, 0xf17d5562,
+  0xf702b3b9, 0xcc4c8563, 0xcbca275d, 0xe005d9d1, 0xe817dbac, 0x05c6920a,
+  0x62cee350, 0x0f1deac0, 0x19e049b9, 0x59599f74, 0xb2a27a16, 0xf0911d5a,
+  0x7dcef00d, 0x3603dd66, 0x37552251, 0x97813735, 0x5fa022da, 0x0d849416,
+  0xefbe57c2, 0x30a0e592, 0x57619296, 0xc953cc47, 0x11735043, 0xa83526ad,
+  0xc0444be0, 0xb5f8463c, 0x16ff5136, 0x2a0a6631, 0xf037572c, 0xd30464da,
+  0xb1bf8daa, 0x7f5718f7, 0x0f3e9e7e, 0xe5a4cfe7, 0xc26f2624, 0x8c9b5ae4,
+  0xdfe8f485, 0xf6fa82e3, 0xc64a1509, 0xacb24aea, 0x3024b220, 0xddb02ac0,
+  0xddcdfedd, 0xd834c574, 0x384c86c3, 0xd904e099, 0xdd48a571, 0x4550a05f,
+  0x77b35c74, 0x81e85f71, 0xaaebdc6d, 0x0f9bb0b1, 0xd4cdc054, 0x7af4df85,
+  0x845786af, 0xe5e53887, 0xdf2a91ca, 0xf6a58211, 0x5689a3c4, 0x8cf6aa15,
+  0xa705983a, 0x9fbf2f52, 0x2ce7fef0, 0x48e84a62, 0x4a3b5365, 0xf8281a47,
+  0xd48a0872, 0x8423dcf6, 0xf0929c3e, 0x044a5049, 0xe9ec071b, 0x17decc36,
+  0x20e30c1b, 0x45fc2813, 0x3342196a, 0x46afb7f9, 0x6601e337, 0x30754439,
+  0xf18094d1, 0xd38b4112, 0x61410dd1, 0xd8796b36, 0xd97d4dd8, 0x47e9bc0b,
+  0x80805191, 0x1584e2da, 0xcde438c1, 0x955d24f1, 0x409659a1, 0x1b0950b1,
+  0x5a09635f, 0x65b1febe, 0x615472b9, 0x525dc00a, 0x6308e067, 0x4089e2d4,
+  0xd4e705a4, 0x43fc9209, 0x32c18b26, 0x4447a5fa, 0xaf271153, 0x3617cadc,
+  0x4dc4f0d2, 0x692eb386, 0x6aa116ef, 0x655991bc, 0x0641dc0b, 0x54469597,
+  0xc6559664, 0x749c0fe8, 0x4bdc0d1a, 0xa7d3381e, 0xc5292a61, 0x4eb65fdc,
+  0x42474cc2, 0xf2c6b173, 0x19dfc9ee, 0x0a19a199, 0xbece2ee3, 0xc68b778d,
+  0xaa03aa7c, 0xc8db86f0, 0xae54d2be, 0xb92a01e0, 0xdee3f48f, 0x6023c0a9,
+  0xf6ae2852, 0xa233763b, 0xa441cb9e, 0x3246dddd, 0x3a8bb4b7, 0x44faa3c3,
+  0x308ef2c8, 0xfd1c8516, 0xd2862534, 0x3b25ebe7, 0x62336f6f, 0x0c336a45,
+  0x0b8e2ce6, 0xe867f171, 0x11eea1f2, 0x523972ec, 0x68df4903, 0x50c05824,
+  0x51ef4cb7, 0xcb4df2a8, 0x3ffae115, 0xb51aca2f, 0x3ed1635f, 0xd6ff1cc6,
+  0x0a5ac09f, 0xde8ed9d6, 0x0a3dc76f, 0x5dc2d8dd, 0x37991dde, 0xf95bacb2,
+  0x80ad6e13, 0x163005ee, 0xd4f8c7a6, 0x3225d180, 0xa4760f08, 0x5fff004d,
+  0x9b2b1a87, 0xe7ea8576, 0x5cd00b66, 0xec478452, 0x285dd80d, 0x20112439,
+  0x4301b3a1, 0xff879fc8, 0xfacbb68c, 0xaf6af6b8, 0xb17fdf84, 0xc208d9f1,
+  0xf4489576, 0x8794a6e9, 0xadcc862c, 0x0e83e54c, 0x931685a4, 0xab01c580,
+  0x1e40293b, 0xcad784fa, 0x1f1ddf7f, 0x6b856084, 0xcee722b2, 0x1c39938b,
+  0x74254eb4, 0xc7ccebf4, 0xb9c26d9a, 0x6b08dfb9, 0x2e3ece24, 0x981455ec,
+  0xdff60410, 0xbc804e2b, 0xe06fa38b, 0xb534540c, 0x72e53c52, 0x02dfb2ef,
+  0xb2a5c05a, 0x5002a2a5, 0x97313338, 0x597c53ff, 0xd61df455, 0x34e5261a,
+  0x39ac2ec5, 0xc6bc0cab, 0x388b7539, 0x3f732fc0, 0x00eac704, 0x92fb21d9,
+  0xc089971e, 0xb4ffa503, 0x7af93f8f, 0x72e353b6, 0xa8311b23, 0x8266c9af,
+  0x1de496ca, 0xdbdb16b0, 0xd6fa0b51, 0x9991a5ef, 0xbd563089, 0x168cbe0f,
+  0x0954a1e3, 0x537b9245, 0x53d09723, 0x2867272d, 0x86558cb9, 0x0b83f026,
+  0xfac85d10, 0xf8562951, 0x1e5ddb95, 0xad3668c8, 0x48d27b92, 0xc930b7e6,
+  0x19b58a99, 0xa3de74e3, 0xa9cda917, 0xcb6e35ee, 0x7a4dd16e, 0x4c80e9d5,
+  0x4d84073f, 0x74a95ba8, 0x9cffcfc0, 0xd28485eb, 0x15796372, 0x5717e9cd,
+  0x77eda8df, 0xab473c4e, 0xadb965e1, 0xffad6959, 0x5bc05659, 0x6ed63880,
+  0xfb240227, 0x2014850b, 0xd15fdddf, 0xfdd74592, 0xb538f37d, 0x3a8e2e82,
+  0x1473396f, 0xf6a5edf8, 0x3ce41a21, 0x0cc4351a, 0x754e8264, 0xaab95e73,
+  0xc7821b96, 0xf42ff463, 0xc242faaa, 0xdd00ac65, 0x087e260e, 0x17d193f5,
+  0x0dbe0328, 0x844a63c9, 0xf9d10f96, 0x85aa91dd, 0xbaf127ec, 0x0ab6dabb,
+  0xce85e6a5, 0x1af5d24f, 0xe7b56a16, 0xcd6c5a19, 0x57d1d79f, 0x5dfc2b28,
+  0xec4dd2f0, 0x18fe64a1, 0x8d72216a, 0x5f222077, 0x72f14a08, 0xd8b09b11,
+  0x3bf038ab, 0xc6cf1f44, 0xc4265d7c, 0xdab1b0e7, 0x46398d2c, 0x7dcfdc68,
+  0xb6e705d3, 0x4aafd1e6, 0x362c1183, 0xd8701107, 0xf6ac98b7, 0xad114d7e,
+  0xd6649424, 0xc40ab551, 0xddd1c6e4, 0xa132030f, 0xc9d284c8, 0xdb1f662a,
+  0x824069ee, 0x4157904b, 0xc846b3ad, 0xd38481ca, 0x0a248c17, 0xc846831f,
+  0xe8745feb, 0x000025a8,
+
+# define TENS_P14_IDX	(TENS_P13_IDX + TENS_P13_SIZE)
+# define TENS_P14_SIZE	1703
+  [TENS_P14_IDX] = 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+  0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+  0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+  0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+  0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+  0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+  0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+  0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+  0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+  0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+  0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+  0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+  0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+  0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+  0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+  0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+  0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+  0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+  0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+  0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+  0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+  0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+  0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+  0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+  0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+  0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+  0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+  0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+  0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+  0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+  0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+  0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+  0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+  0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+  0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+  0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+  0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+  0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+  0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+  0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+  0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+  0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+  0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+  0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+  0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+  0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+  0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+  0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+  0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+  0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+  0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+  0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+  0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+  0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+  0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+  0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+  0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+  0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+  0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+  0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+  0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+  0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+  0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+  0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+  0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+  0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+  0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+  0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+  0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+  0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+  0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+  0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+  0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+  0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+  0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+  0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+  0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+  0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+  0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+  0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+  0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+  0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+  0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+  0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+  0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+  0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x099f0001,
+  0x41b5687d, 0xcbfd1b6e, 0x8c75ee63, 0x4b191cea, 0xd75296ad, 0x2394d80a,
+  0x1eb5da9b, 0x18a004ed, 0x5c79fed9, 0x37e3b01c, 0xed67a1b8, 0x78d9a714,
+  0x2a1a34d5, 0x8fbe7f0d, 0x6b1d3516, 0xe57c43ea, 0xa7825681, 0xc81d32e8,
+  0xd3e716e1, 0x58860b00, 0xa6d93d65, 0x83159c97, 0x0113232f, 0xd6122269,
+  0x7321c3a0, 0xbe6a92f3, 0xca4ca9d3, 0xd1e276a5, 0xc0e55163, 0xb05915d6,
+  0x7b7a78c1, 0x0fae0ca4, 0x62a3df4b, 0x08abec6f, 0x13030d11, 0xd446338a,
+  0x60dcc8f2, 0x5f05d1d5, 0x25e1f9f6, 0x04a40bee, 0x7f8c7113, 0x88f47ec0,
+  0x589ff59a, 0x308c3661, 0xea5068a1, 0x95fb108f, 0x06e87dff, 0x1559e741,
+  0xd4d4abdc, 0x01e092e4, 0xee16907c, 0x5a7b78e6, 0xe73aabcb, 0x146bb7e0,
+  0xad372889, 0x4f6b43c5, 0xfd49fc1d, 0x0f29f589, 0xd3739253, 0xc4745a56,
+  0xe2acfcc2, 0xd75ccbc7, 0xedd016cd, 0xac5a63e0, 0xef82ccd3, 0xb352496e,
+  0x2bdabfc4, 0x5b3d0401, 0x01b0197f, 0xade96d3c, 0x29d9253d, 0x19bebdba,
+  0x73c56b1b, 0x255e7b25, 0x1f2b7f1e, 0xa56a457e, 0x6299c836, 0x5c63cc78,
+  0xa2ca74c6, 0x5c85fe93, 0xee571bea, 0x508e2561, 0x2db5f1d0, 0xb1fde6a9,
+  0xa9b87b99, 0x4fb90a37, 0xf7260f07, 0xff58c5fd, 0x56ee7e97, 0xbab9fa46,
+  0x42e6f9ce, 0x78816f73, 0x1b76d267, 0xfdb2c728, 0x4566519c, 0xae17dd8d,
+  0xb9f6a95f, 0x1cd533a1, 0x67160dea, 0x14534bac, 0xfcd8f8f9, 0xf3f2901d,
+  0x708b1f0a, 0x8829063b, 0x9457a1df, 0x8f872aa1, 0x36bb9335, 0xb5672c0e,
+  0xd889d109, 0x7ec63a6a, 0x93306672, 0x39b6d457, 0x8239ab68, 0xef2e2506,
+  0xbe0d7a1f, 0x4251b635, 0x05f65522, 0x0ef0bd55, 0x03286891, 0x2c42b664,
+  0x9815fbac, 0x471fd611, 0x814e379c, 0x7dd8349d, 0xa4a25bda, 0x9886b84c,
+  0x01b9e39d, 0x5a7ce1a2, 0xae31cbc9, 0x86d07f32, 0x83ef8faf, 0xb66b5b76,
+  0x58470fdf, 0x96d59b73, 0x51618889, 0xdc400cf7, 0xfc8e0fc6, 0xaf693670,
+  0x09a08e56, 0x91737de6, 0x74f682e1, 0x0e03923f, 0x7f8ac56d, 0x7400cfd4,
+  0x8e05e49a, 0x4cebea3c, 0x384e1164, 0xb2e43d8c, 0xb50ae05e, 0x0f0b3ed9,
+  0xa4006123, 0x64137137, 0x4e9a1934, 0x05404100, 0xd9621be6, 0x9329a255,
+  0x5c347ebb, 0x75cbeb1b, 0xe684346b, 0x840fee55, 0xba6a9753, 0xf43836f6,
+  0x60505b7b, 0x334a9278, 0xfd6d475d, 0x5db94761, 0x267375aa, 0xc110e160,
+  0x024f6d63, 0x2ec96610, 0xa99b4c19, 0xb915c9f4, 0x338cfd90, 0xf02ea846,
+  0xb9e51a09, 0xae928fb1, 0xfae31d88, 0x1a3db721, 0x8475dd26, 0x5769489d,
+  0x7ad4c407, 0x0a49e9f0, 0x34e275c8, 0x3d075d83, 0x1d63114a, 0x72a96415,
+  0x6b98e947, 0x1d500b5f, 0xd50fdc36, 0x141e5085, 0x87751275, 0xe7843834,
+  0x2278809e, 0xb15c52ee, 0x947aead2, 0xfedb7b02, 0x5197b744, 0x64e09ba8,
+  0x8849d0a6, 0x23beaa85, 0x11ecb913, 0x0f7ed667, 0x5d984848, 0x9f6331ea,
+  0x588290e9, 0xa24d64d1, 0x7e09e9e5, 0x32592033, 0x03a501df, 0x27c270a6,
+  0xbb3df738, 0x3c7c5a70, 0x4190833c, 0x7d4bf9f4, 0x80e5d89b, 0xa7fc6194,
+  0xfaefb663, 0x62e52b49, 0xd3b6adcd, 0x809646fc, 0x1f2cf73a, 0xb765ed4f,
+  0x531e4bfb, 0x92cd05f2, 0xaf12d1a6, 0x22ee30f3, 0x38da1074, 0xed6447bb,
+  0x1a725608, 0xaff222d3, 0x7a3c6f54, 0xbca79a56, 0x7b0e8d12, 0x1c4660c5,
+  0x6e34d6fb, 0x6f481a9f, 0xfe9dc99c, 0xf888db82, 0xd8489ea0, 0x84b4c0fa,
+  0xc0dea281, 0x977a8583, 0xae30e887, 0x8c1cbcec, 0x1d4848cb, 0x0ee0d137,
+  0xd011b0fc, 0x94b5fd49, 0x478d7dd4, 0x3d67f2e7, 0xacab62ad, 0x0ab4e62a,
+  0x1dfc7df5, 0xd22e4553, 0x870b0e75, 0x49b7b001, 0x1b73bf6d, 0x12807ffd,
+  0xdc9f0737, 0x6f3e5852, 0xc0e2f250, 0x93e62e4a, 0x4d96a55a, 0xc1d0e185,
+  0x83a126db, 0x190b917b, 0xefbfd043, 0xc7df1669, 0x8f25b6dd, 0x2062eac9,
+  0x476c17a6, 0xcb60f278, 0x25460383, 0x0e85e996, 0xda8c05be, 0x6f678a34,
+  0x69206234, 0xf59be929, 0x1947b69a, 0x0ebfa11b, 0x90fd8322, 0x15c1e9bf,
+  0xd699b1ec, 0xb2f0343f, 0x7001d002, 0xcf76eaaa, 0xc0778ab5, 0x5173eda8,
+  0xb7b008e2, 0x4e00e4c6, 0x505d3f4d, 0x99dd341a, 0x1c9d4e12, 0x4ffb6978,
+  0x474c5e95, 0x6e9ca6dd, 0xda19f938, 0xe2dda6e0, 0x98dc318e, 0xda455e54,
+  0x3f67b836, 0x21e4181c, 0xa97e9a64, 0x1e17f655, 0x527a08bb, 0x1712dc21,
+  0x682972ad, 0x0042d256, 0xccbeadf1, 0xca497b96, 0x861e99e0, 0x0d8aa585,
+  0xeeb0f650, 0xdcc3c3da, 0x506af77e, 0x5deb9768, 0x7c9d60be, 0xe9d978b7,
+  0x37b37e95, 0x77ad0b94, 0x42747f75, 0x07be42c4, 0x6d5fd2fe, 0x4c8c5da9,
+  0x0d8fc27d, 0x0f2fd50f, 0x0ccf6023, 0x5b56053f, 0x3b1101bd, 0x56d34906,
+  0xc0feca27, 0x7602a150, 0xc4888da4, 0x419abe54, 0x56d10633, 0xc76120ed,
+  0x8db14123, 0xb656e675, 0x741e8f76, 0xd297b94e, 0x96be6f21, 0x3662439d,
+  0x9b409e27, 0x6626574d, 0x35fff92a, 0xbf558205, 0x69e02439, 0xbe6838b7,
+  0x6400fd4c, 0xa00f64ca, 0x1f4b158a, 0x9e2052ae, 0x04cca558, 0xfb5ee69e,
+  0x58da644c, 0x96f26e1f, 0x8ab19401, 0xbee1e16b, 0xed8bf908, 0x2f2809a4,
+  0xd50babab, 0x6e57f7e6, 0x6b0a8929, 0xf7356431, 0xb54a4cfc, 0x9a1d0ac4,
+  0x6f9fd6cb, 0x836bfbf8, 0x3b42f469, 0x8bd32129, 0x40111b6b, 0x7c278fb1,
+  0xb345d955, 0xff1fd188, 0xd32cd13c, 0xf7ec3aa0, 0x3789f792, 0xab707fa4,
+  0x4d79a4bf, 0xb3a28ceb, 0xd9c24d8e, 0x7134dadc, 0x06e2eb3e, 0xd7c04f76,
+  0xb379d811, 0x2b3b0ebc, 0x8c94fc33, 0xa28b53ab, 0xc06c5d01, 0xd900432a,
+  0x7fea91ca, 0x6d30b008, 0x64845f08, 0x796f5349, 0xfde4687d, 0xf888fe67,
+  0xe0046c56, 0xae482177, 0xce98cb11, 0x84590c46, 0x1feb4400, 0x6e1ba29b,
+  0xff2f1611, 0xf73f3e9c, 0x3159ca8c, 0x34845918, 0x56f0ed46, 0xb7d10c32,
+  0xd9a16a01, 0x405b9e91, 0x3cee3e24, 0x8739e4a6, 0x2ab396b4, 0x3f1b7871,
+  0x09835dfd, 0x8c7a489f, 0x1592b74a, 0x05df7c81, 0x0e8d3f37, 0xa61ff273,
+  0x68b29622, 0x259cd337, 0x43ff84a6, 0x81cf8fe9, 0x566ed883, 0x48427fc6,
+  0x35c79428, 0xcfd2fb59, 0xa97e8c8b, 0x750aaed8, 0x32ddca23, 0xaa8108ef,
+  0x96fbfff9, 0xa1d039aa, 0xe3cdf588, 0x47e77e00, 0xcd6b3fdb, 0xe72a9a80,
+  0x9a522152, 0xeda06283, 0xef175610, 0xa670cfa1, 0x339fe6c4, 0x2dfbf3ee,
+  0xc2d7f53b, 0x92a44e27, 0xcc47e4b0, 0xdfa212bc, 0xd64f83c9, 0x997e5475,
+  0xb51319bf, 0x9fffe599, 0x1fc2c7b6, 0xef5605e7, 0x832169dd, 0xfeb6be4e,
+  0xbf921dc8, 0x60bdfb1d, 0x72759f8d, 0x3546efa0, 0x020eebed, 0xcaab3d64,
+  0xdb20a2fe, 0xba1218f6, 0xb2b62bdd, 0x3101eff0, 0x8fde5cfa, 0x2e319213,
+  0xa52114d2, 0x87eead3f, 0xdf08b1dd, 0xa5387642, 0x746f34d0, 0xd76c4844,
+  0x4cc40317, 0xe4f689c9, 0xb7d76071, 0x5fe0b4a2, 0x6e1c7915, 0xc7d43f53,
+  0x3efb7d71, 0x068dd906, 0x35a75f5f, 0x652d7770, 0x750f4607, 0x64a1656c,
+  0x36c2cf8e, 0x214d758b, 0x9348ef93, 0xe4058978, 0x9674b7f3, 0x10570b0b,
+  0xbdfaba8f, 0xcef09dd7, 0xa92b261f, 0x071c21b6, 0xcbebb81f, 0xf427ed6c,
+  0x44228cd6, 0x65e56fcf, 0x5036c460, 0xad919def, 0xccfd848b, 0x61d158a6,
+  0x7527dca3, 0x4cf30459, 0x50855075, 0xa70dfd09, 0x3540f5aa, 0x35577adb,
+  0xb5ba3d4e, 0x35736c4f, 0xcdfb689f, 0xefe8fa82, 0x97ab0dca, 0x51bd2ff3,
+  0x77a7fe9c, 0x3107846c, 0x3d618b81, 0xbca797a4, 0xfc5e9651, 0xe2e08fbc,
+  0xf7e8791f, 0x772f1cc0, 0x7c426f9d, 0x08d56f88, 0x0080c3ab, 0x0deea663,
+  0xe6d46ec6, 0x7dca4eb7, 0x6b681d9d, 0xda06730b, 0x4af0e0f2, 0x038bf468,
+  0x52097463, 0xca19d302, 0xbc09bb9a, 0xaa55aeb1, 0x3ded4433, 0xf27938ba,
+  0x3e4b7865, 0x28296be7, 0x7ef96314, 0x7a1d55cc, 0xdf0b6b47, 0xcde11852,
+  0xcedda5bd, 0xf00a0eb3, 0x72ca1a8b, 0x5241b572, 0xb002fdcc, 0xff8898b3,
+  0xc4878862, 0xb3e85372, 0xbf4bca29, 0x7e1fef45, 0xf2d83189, 0x0f5427af,
+  0x3cdf9e05, 0x75bae885, 0xf65c06ac, 0x9c71a700, 0xa3145eac, 0xde63bab2,
+  0x76255bbf, 0x6e817be6, 0x4c6ad3d0, 0x25ab9935, 0xe95ef2f8, 0x11cd095a,
+  0xd54f78de, 0xa001ae7e, 0xb3829dcb, 0x5abd18bd, 0x18eb9c9e, 0xada3c504,
+  0xe3e3556c, 0xd35479aa, 0x5191ac5f, 0x221821ac, 0xc8d1d9d3, 0x313a8c51,
+  0x088c3fc8, 0xc146a264, 0xb154abed, 0x92755bc5, 0x349ec093, 0xf94aba57,
+  0x41d5886c, 0x0a5ad8b2, 0x36aba94b, 0x883a6758, 0xa9ad229f, 0x5d64069a,
+  0x0546172f, 0x0366da16, 0xc3808ea4, 0x0b172403, 0x70f0a235, 0xfa816e66,
+  0x4fceb827, 0xa65fcfea, 0x167b56d5, 0xfe2b9fb2, 0xfec36bcd, 0xa84c4cc9,
+  0xcd96320f, 0x3e128584, 0x09eda8b8, 0x91eca525, 0x7ec7e17b, 0xbc45bedc,
+  0xc14032f4, 0x9be689a7, 0x2eb20bc0, 0xffdf1efc, 0x14ef835f, 0xc6966c59,
+  0xcd778dd8, 0x5feb0f3b, 0x23d47715, 0xd64b87c8, 0x5722a550, 0x62883198,
+  0x315a1a8b, 0x648e17e6, 0x4b7e9d7a, 0x2ba43d28, 0x67caca84, 0x741f0398,
+  0x6e660159, 0x3e16e1a9, 0x3dde3c45, 0xa53e56ae, 0xc7eb0aef, 0x3f39f33e,
+  0x78751d73, 0x45816df8, 0x626770f7, 0xcb17d28d, 0x909e87f4, 0x93a86aba,
+  0xc1dcf328, 0x1a1e4ce2, 0xd895d042, 0xb9f6dd69, 0xbb00eaf5, 0xacc37687,
+  0xca609578, 0x5b490d39, 0xf8b86d4c, 0xf2737ef0, 0x39419f6d, 0x69267bc0,
+  0x72524a03, 0x6eb060c4, 0xdbc01e93, 0x291035b1, 0x83984d54, 0xf673ad85,
+  0xe08cbc20, 0x1fb24915, 0x584803a6, 0xe15bbcd7, 0x4088ddb5, 0xd4c22542,
+  0x2c18041a, 0xa51372d1, 0xb2ba69b4, 0x2299283f, 0xcd11c296, 0x25dcd6f3,
+  0xac54df23, 0x24a3a55e, 0x77e16e1d, 0xb3cd415b, 0xb99d85c0, 0x497befc7,
+  0xe91154e3, 0x7365cd8b, 0xb55100aa, 0x0ee699eb, 0xfc0927a6, 0xefb374de,
+  0x8acaa910, 0x83b40e3d, 0xda3f0006, 0x8590a089, 0xc6ce1b75, 0x54f6ff20,
+  0xfda2f7f3, 0xd2ab58f6, 0xd0763b6d, 0x6caf2515, 0x2519622d, 0xc3714057,
+  0x9863638f, 0xea00bb4f, 0x09ea4a4d, 0xe69de96d, 0x6b01fe5f, 0x960161a5,
+  0x529e32ec, 0xf8260ae9, 0x01a37eea, 0x69710577, 0x5aa0716f, 0xcb3fb1da,
+  0x4260feda, 0xa33fb790, 0x76012f75, 0x24c0e5be, 0x130f09ae, 0x2e8323dc,
+  0x5c8ecb76, 0x17cb8f12, 0x401b5f5c, 0x5f0a63e0, 0x47e1560a, 0xdc57a786,
+  0xee1377d4, 0x228e7ee5, 0x0aa294b9, 0xaea6c534, 0x55b0fe2f, 0x922d318a,
+  0xf108b772, 0xf15bddf6, 0xdfb69702, 0xcd438a4e, 0x90e1db66, 0x584ce4a1,
+  0x568ef6cb, 0x69e55f9d, 0x6da376ba, 0x5ca6c109, 0x45c7e294, 0xc977b3e9,
+  0xcf5b6c0c, 0x1d694499, 0x11b487ae, 0xcf8339ac, 0xbcb3cc6e, 0x50b828e0,
+  0x046b1071, 0x5703ed0d, 0x2c615946, 0x720d1610, 0xa908dbd0, 0x742bbe33,
+  0x22c076e2, 0x48966a66, 0x1d0cefa4, 0x1dde819f, 0x601352bf, 0xb9370c39,
+  0xa585cc4a, 0xeb857f94, 0x5a2f7206, 0x3fae6b58, 0x49cd0f1f, 0x78e5fb3d,
+  0x1b89d476, 0x74e9e65b, 0xed82945b, 0xb74e6483, 0x2941c4d9, 0x7e087acc,
+  0x565c18dc, 0x1a09f2e5, 0xbf4ccd3d, 0xd304e977, 0xa522631d, 0x6123378e,
+  0x4517109b, 0xb7e4285a, 0x4bf1a506, 0x625803c2, 0x683172f8, 0xc84e7354,
+  0x3f8a2b11, 0x7dd12b89, 0xed420491, 0x8c698b0b, 0x9853fb97, 0x9631777b,
+  0xb697e1c9, 0x5f028f05, 0x51038110, 0x9055f055, 0x30e255e3, 0xe2d0c1b6,
+  0xb990321e, 0xa8fdf4d1, 0xff4dc144, 0x521a3056, 0x148999e0, 0xa8111c66,
+  0xa9c96852, 0x8157f508, 0x4b394a94, 0xa0dc4df1, 0x94ec2e93, 0x6e6afa56,
+  0x8fc28377, 0xf72ffa04, 0xc435186f, 0xf91488b7, 0x8d037f6f, 0xa899ec1e,
+  0x48757727, 0x4101b612, 0xb8cf377d, 0xa5a54e68, 0xb4570569, 0x2ac5a0a0,
+  0x063d9cfd, 0x7c504c74, 0xf1a5884c, 0x0a9b1955, 0x8d0b91bf, 0xe5f6862f,
+  0x79ff5361, 0x0ed3d38f, 0xc6fd31fb, 0x9fe131c7, 0x85b9c648, 0x8febf2b4,
+  0x8e77e86b, 0x992ba80e, 0x56429986, 0x6848879a, 0x608cdda5, 0x3e0d106e,
+  0x754b300e, 0x25200576, 0xafd5195b, 0x5d37aad9, 0xe81f0939, 0xe00a390e,
+  0xdeeea20a, 0xf5fef0be, 0xb5d51155, 0x6e27d173, 0x9e72ebcf, 0xb776e978,
+  0xb966f7ba, 0x09520238, 0x726c8408, 0x3347ebc5, 0x65dce5a2, 0x3ec78337,
+  0x8c92d740, 0x3cdde3fe, 0x32caec93, 0xd20379ae, 0x411be811, 0x41756580,
+  0x72fa1bbd, 0xa92125b3, 0x84c42f04, 0xdd4ee5fe, 0x3a25922c, 0x96446853,
+  0x49ad3be0, 0x2880366d, 0x1c841afe, 0xf1e09019, 0xfb905fe1, 0xa451ad59,
+  0x3ba9d0c9, 0x56db2e9c, 0xa42419f2, 0xe921e7a0, 0x3c9a3ca5, 0xad8ea375,
+  0xcec7d091, 0x99bdb940, 0x477ef58f, 0x8a4933c7, 0xb2598b8d, 0xf5659df7,
+  0xcfac1e1c, 0x339f8748, 0xe2a04aab, 0xe122b03f, 0x45bc6f37, 0xc9feeb30,
+  0x9c75aaa0, 0xc13c174e, 0x0ea0585d, 0xdc58bbb4, 0x3a96bd5a, 0x20251482,
+  0x3c7a714d, 0x696897eb, 0x6cb83b6b, 0xa37de406, 0x3b496b5f, 0x37e75d6a,
+  0x380dd382, 0x0e1a513c, 0xda26fac9, 0xf2458364, 0x12b5c6ea, 0x79ce9e47,
+  0x1ff1fcbf, 0xbe7c6e86, 0x59a6a7ba, 0x8d70f515, 0x94761453, 0x6b04e425,
+  0x8768ffb2, 0x1ca5f425, 0x3f9e8407, 0x3b641184, 0x5f8f6756, 0x62b1a5a5,
+  0x56bc2120, 0xd1e5da68, 0x17f2fa18, 0x8cce5e2d, 0xa1bc9c06, 0x8e290fb1,
+  0x892df1af, 0xad10b8c8, 0xb43e5517, 0xd0597409, 0x4407c38f, 0x4a020d81,
+  0xfea9c9b6, 0xd8e0e7d6, 0xd5b2aaf9, 0xde5e9b40, 0xda44ed4a, 0x45d6bf41,
+  0x87aa3ca0, 0xc62d12fc, 0x4708acc8, 0x10212e26, 0x0d1227ff, 0xfeeb5742,
+  0x5da02550, 0xd66668e7, 0x1d56e5e1, 0x32c215ec, 0xae1e0bef, 0x7f048b7e,
+  0x58c0e922, 0x2aea8619, 0x58251aac, 0xbbe10425, 0xa1fea536, 0x2e1d9667,
+  0xd233eb7d, 0xcf435c0b, 0xb0693c67, 0x61d918ea, 0x903ec9f0, 0xd6c4e8ac,
+  0x0efb1788, 0xb0098f5b, 0x1709d878, 0x3c12b35e, 0x3f6ce1b7, 0xa1b3ff54,
+  0x8a8f7dbb, 0x37608d6a, 0x73e8563e, 0xa3330540, 0x64e00749, 0xebbfcab9,
+  0x8d5caaf9, 0x3bc87c7e, 0xedb2bd94, 0x22f8f62d, 0xe656dec3, 0xc5683222,
+  0x670c1626, 0x94089e7f, 0x4237542f, 0x47d29440, 0x2fc4e530, 0x8419441e,
+  0x8b288dac, 0x7f9245f9, 0xa7afb4e9, 0x8a15650d, 0x082adef7, 0x3104ef19,
+  0x043c62de, 0x0aff3dc5, 0x7ecd0635, 0xe7e80a8b, 0xe0600fad, 0x4d8e81cc,
+  0x81ebf4e0, 0xf587e30f, 0x7b372af7, 0x2d8f8ca0, 0xdee11c6f, 0xd3624b1c,
+  0xf8adc426, 0xca9debed, 0x5c22de4f, 0x3634f778, 0xfae3186b, 0xacf8b595,
+  0xd7bfa75f, 0x003cd316, 0xbbfe3cf6, 0xb023cb50, 0xc51055a1, 0x0063cffd,
+  0x93869a77, 0x51e022d4, 0xfbceeb10, 0x5187457e, 0x109defc9, 0x673892d8,
+  0xe13cfde2, 0xd4aa3272, 0xc09c8134, 0xbf89ad5b, 0x0327181b, 0x09511ec7,
+  0xaa21b632, 0xd7e72186, 0xe41885b5, 0x46713f9c, 0x493d2789, 0x1386c526,
+  0xd5d22a5c, 0xcefddfc4, 0xcf59281c, 0x92973ea6, 0x4ebe43f6, 0xeac5c6ad,
+  0x6cf4897d, 0xd95082a0, 0x82ce562a, 0x28e5e9bd, 0x28d8f0db, 0xddf06e81,
+  0x707b0166, 0x7dae3f00, 0xfbf5756a, 0x035a4680, 0x4f114102, 0xe7ba4b33,
+  0x5190fedf, 0x106a7594, 0xe5f1bc49, 0xaae3ad67, 0xd7a1a766, 0x040ee971,
+  0x9120a214, 0xf415b374, 0x1edc87ea, 0x17aab43c, 0xc6ad637d, 0x885858c1,
+  0xd90303c7, 0xbfd4b70b, 0x3ff4eb0e, 0x344a9a88, 0xd81eea30, 0x95925446,
+  0x5adef0ec, 0xabb5f5e7, 0x20bbd8c3, 0xc1c22cce, 0xe6944262, 0xc5acdb23,
+  0x80024021, 0x2232c635, 0x94b30c81, 0x55f07648, 0x78569acd, 0x9696ea39,
+  0x4dd6b528, 0x1c3e1b40, 0xde5853b3, 0x8a2c3679, 0x6eb5a7d8, 0x56bda89a,
+  0x8f9cf096, 0xfda86d5b, 0x6481c7e7, 0x50a6a7d5, 0x15bfb45d, 0x4f9a5381,
+  0xc057d45d, 0x4fb10024, 0xa0009f00, 0x5e1ca0dd, 0xac420f74, 0xcfbb38bd,
+  0xf0d4a615, 0x19bf0318, 0x0e3aef84, 0xcb3d7b20, 0x166c1e3e, 0x58272fdd,
+  0x3bfacf9f, 0xc0f5ce46, 0x63a13528, 0xea59e333, 0xa020ca8c, 0xaadd116b,
+  0x3dbb5a3d, 0xe5523f47, 0x747f55ea, 0x0922171e, 0x64d520fb, 0x6c709e84,
+  0x07ce951b, 0x35fdc402, 0x7508eb6d, 0xc495a8fa, 0xb0d11c39, 0x81313d65,
+  0x57447ef0, 0xa7b61e26, 0xf72301f3, 0xbb096315, 0x45a3a7c5, 0xa903a44b,
+  0x00432f88, 0x19081987, 0xeb4e1b66, 0xbb7b66bd, 0x6d245171, 0xde4182f5,
+  0x0d89bd0b, 0x87f4de6c, 0xf70d8a60, 0x9a87855b, 0x08a27449, 0x4ac7720a,
+  0xd4964017, 0xb0d9ddac, 0x4db3488c, 0xfe397d44, 0xd07b745b, 0x197dcb7b,
+  0x6e9d567d, 0xe3b90812, 0x9143fef1, 0xb9e002ac, 0x115ff96d, 0xf60a2201,
+  0x5b61c9c8, 0x09abab2f, 0xb14a44a7, 0x0ca19c73, 0x843c7997, 0xe3a9bbe6,
+  0x5e3fc18c, 0x0c0404ee, 0x764df59d, 0x990ec2c2, 0x4ad0ba3c, 0x05e8be0f,
+  0xe599647d, 0xc19d365d, 0x4d0c2990, 0xe5a9d9ac, 0xb680a72d, 0x4ce2e5dd,
+  0x6d6c0267, 0x06f9c25b, 0xbd6078e0, 0xb5fcdc81, 0xd742fa41, 0xcccc2399,
+  0xc691adc0, 0x215ad82c, 0xea73b0c3, 0xa511e5b0, 0xf499e0a6, 0x53e27ab0,
+  0xd94440a2, 0x47752521, 0x9a6e3644, 0xab113708, 0x8f8b301d, 0x058a42a3,
 };
+#endif /* !__NO_LONG_DOUBLE_MATH */
 
 #elif BITS_PER_MP_LIMB == 64
 
@@ -279,9 +711,9 @@ const mp_limb_t __tens[] =
   0x26b2716ed595d80full, 0x1d153624adc666b0ull, 0x63ff540e3c42d35aull,
   0x65f9ef17cc5573c0ull, 0x80dcc7f755bc28f2ull, 0x5fdcefcef46eeddcull,
   0x00000000000553f7ull,
-#if FLT128_MAX_EXP > 1024
-# define TENS_P9_IDX	(TENS_P8_IDX + TENS_P8_SIZE)
-# define TENS_P9_SIZE	28
+
+#define TENS_P9_IDX	(TENS_P8_IDX + TENS_P8_SIZE)
+#define TENS_P9_SIZE	28
   [TENS_P9_IDX] = 0x0000000000000000ull, 0x0000000000000000ull,
   0x0000000000000000ull, 0x0000000000000000ull, 0x0000000000000000ull,
   0x0000000000000000ull, 0x0000000000000000ull, 0x0000000000000000ull,
@@ -293,8 +725,8 @@ const mp_limb_t __tens[] =
   0xb099bc817343afacull, 0xa269974845a71d46ull, 0x8a0b1f138cb07303ull,
   0xc1d238d98cab8a97ull, 0x0000001c633415d4ull,
 
-# define TENS_P10_IDX	(TENS_P9_IDX + TENS_P9_SIZE)
-# define TENS_P10_SIZE	55
+#define TENS_P10_IDX	(TENS_P9_IDX + TENS_P9_SIZE)
+#define TENS_P10_SIZE	55
   [TENS_P10_IDX] = 0x0000000000000000ull, 0x0000000000000000ull,
   0x0000000000000000ull, 0x0000000000000000ull, 0x0000000000000000ull,
   0x0000000000000000ull, 0x0000000000000000ull, 0x0000000000000000ull,
@@ -315,6 +747,7 @@ const mp_limb_t __tens[] =
   0xd2db49ef47187094ull, 0xae6209d4926c3f5bull, 0x34f4a3c62d433949ull,
   0xd9d61a05d4305d94ull, 0x0000000000000325ull,
 
+#if FLT128_MAX_EXP > 1024
 # define TENS_P11_IDX	(TENS_P10_IDX + TENS_P10_SIZE)
 # define TENS_P11_SIZE	108
   [TENS_P11_IDX] = 0x0000000000000000ull, 0x0000000000000000ull,
@@ -428,7 +861,441 @@ const mp_limb_t __tens[] =
   0x35fcb457200c03a5ull, 0xf74eb9281bb6c6e4ull, 0x87cc1d213d5d0b54ull,
   0x18ae42404964046full, 0x8bd2b496d868b275ull, 0xc234d8f51c5563f4ull,
   0xf9151ffff868e970ull, 0x271133eeae7be4a2ull, 0x25254932bb0fd922ull,
-  0x104bcd64a60a9fc0ull, 0x0000006230290145ull
+  0x104bcd64a60a9fc0ull, 0x0000006230290145ull,
+
+# define TENS_P13_IDX	(TENS_P12_IDX + TENS_P12_SIZE)
+# define TENS_P13_SIZE	427
+  [TENS_P13_IDX] = 0x0000000000000000ull, 0x0000000000000000ull,
+  0x0000000000000000ull, 0x0000000000000000ull, 0x0000000000000000ull,
+  0x0000000000000000ull, 0x0000000000000000ull, 0x0000000000000000ull,
+  0x0000000000000000ull, 0x0000000000000000ull, 0x0000000000000000ull,
+  0x0000000000000000ull, 0x0000000000000000ull, 0x0000000000000000ull,
+  0x0000000000000000ull, 0x0000000000000000ull, 0x0000000000000000ull,
+  0x0000000000000000ull, 0x0000000000000000ull, 0x0000000000000000ull,
+  0x0000000000000000ull, 0x0000000000000000ull, 0x0000000000000000ull,
+  0x0000000000000000ull, 0x0000000000000000ull, 0x0000000000000000ull,
+  0x0000000000000000ull, 0x0000000000000000ull, 0x0000000000000000ull,
+  0x0000000000000000ull, 0x0000000000000000ull, 0x0000000000000000ull,
+  0x0000000000000000ull, 0x0000000000000000ull, 0x0000000000000000ull,
+  0x0000000000000000ull, 0x0000000000000000ull, 0x0000000000000000ull,
+  0x0000000000000000ull, 0x0000000000000000ull, 0x0000000000000000ull,
+  0x0000000000000000ull, 0x0000000000000000ull, 0x0000000000000000ull,
+  0x0000000000000000ull, 0x0000000000000000ull, 0x0000000000000000ull,
+  0x0000000000000000ull, 0x0000000000000000ull, 0x0000000000000000ull,
+  0x0000000000000000ull, 0x0000000000000000ull, 0x0000000000000000ull,
+  0x0000000000000000ull, 0x0000000000000000ull, 0x0000000000000000ull,
+  0x0000000000000000ull, 0x0000000000000000ull, 0x0000000000000000ull,
+  0x0000000000000000ull, 0x0000000000000000ull, 0x0000000000000000ull,
+  0x0000000000000000ull, 0x0000000000000000ull, 0x0000000000000000ull,
+  0x0000000000000000ull, 0x0000000000000000ull, 0x0000000000000000ull,
+  0x0000000000000000ull, 0x0000000000000000ull, 0x0000000000000000ull,
+  0x0000000000000000ull, 0x0000000000000000ull, 0x0000000000000000ull,
+  0x0000000000000000ull, 0x0000000000000000ull, 0x0000000000000000ull,
+  0x0000000000000000ull, 0x0000000000000000ull, 0x0000000000000000ull,
+  0x0000000000000000ull, 0x0000000000000000ull, 0x0000000000000000ull,
+  0x0000000000000000ull, 0x0000000000000000ull, 0x0000000000000000ull,
+  0x0000000000000000ull, 0x0000000000000000ull, 0x0000000000000000ull,
+  0x0000000000000000ull, 0x0000000000000000ull, 0x0000000000000000ull,
+  0x0000000000000000ull, 0x0000000000000000ull, 0x0000000000000000ull,
+  0x0000000000000000ull, 0x0000000000000000ull, 0x0000000000000000ull,
+  0x0000000000000000ull, 0x0000000000000000ull, 0x0000000000000000ull,
+  0x0000000000000000ull, 0x0000000000000000ull, 0x0000000000000000ull,
+  0x0000000000000000ull, 0x0000000000000000ull, 0x0000000000000000ull,
+  0x0000000000000000ull, 0x0000000000000000ull, 0x0000000000000000ull,
+  0x0000000000000000ull, 0x0000000000000000ull, 0x0000000000000000ull,
+  0x0000000000000000ull, 0x0000000000000000ull, 0x0000000000000000ull,
+  0x0000000000000000ull, 0x0000000000000000ull, 0x0000000000000000ull,
+  0x0000000000000000ull, 0x0000000000000000ull, 0x0000000000000000ull,
+  0x0000000000000000ull, 0x0000000000000000ull, 0x0000000000000000ull,
+  0x0000000000000000ull, 0x0000000000000000ull, 0x0000000000000000ull,
+  0x0000000000000000ull, 0x9f34522664cf8001ull, 0x7b8d5053644963e5ull,
+  0xb945c82f49f0aa29ull, 0x933b6bb8430ff478ull, 0x64c501d45ff82d0aull,
+  0x9ec1e1b373bbf174ull, 0xe90106893bfbe803ull, 0x3fef8d80f7390d8eull,
+  0x2c73446bf31d1325ull, 0x1c19e379f5ca7a92ull, 0xf52d9d9c270af2beull,
+  0x3abf72e1eb2bed48ull, 0x7ecf35084ac4ffc2ull, 0x38597a5a22019a82ull,
+  0x9a51ff6ebe6a7b3cull, 0x0c0abe9da2d28437ull, 0xc79887ff7c9ec6eaull,
+  0x436420d05851c899ull, 0x72b5547fefead581ull, 0x077ad8f899b1d2b5ull,
+  0x3b4305ed5cddbf5bull, 0x2d88f3fde3861ac7ull, 0x393220aa3d6b43beull,
+  0x1cd62095e5382405ull, 0x87a0d1e161a10c96ull, 0x68c933e6ca95a55dull,
+  0x778089bb9ee082e2ull, 0xfbb6d8d441429ee9ull, 0x26cf5471c529500dull,
+  0xd6c9b14068b9be29ull, 0x8415185207be635aull, 0x83730335b5572182ull,
+  0xdd312d31eb2300b4ull, 0x488da59c05d6dd9bull, 0xda2c2e4037784d25ull,
+  0x6a57d7206a8d92faull, 0xf07a8632950b41acull, 0x2ecad06acd55f062ull,
+  0x34c98bb0e6a3dfe7ull, 0xb60521b19c767d8full, 0xe87d16be752aafd1ull,
+  0xe58a8b0c9de1d728ull, 0x2fa2c119c6013830ull, 0x519b40c83c4f9156ull,
+  0xab78701b5058fc8full, 0xc502a554adc59c47ull, 0x6647f04c0fb3286full,
+  0x5ea495c89db4076eull, 0xb4f00f8b9c74fab1ull, 0xd092b4c6897c7a3cull,
+  0x32f31fa8283e0340ull, 0x67b63de2eeb708ccull, 0xef2bc02b4f7b3c8bull,
+  0xc49344c0da14bfe3ull, 0xb6c4e69eaabc85beull, 0x63a110162ece8aa6ull,
+  0x726ae4d919cfba4dull, 0xee6ae7070fc90b42ull, 0x4d9aabc54290b04aull,
+  0xf34906cdfb2b070eull, 0x52ca97091ff54b0aull, 0x164315700b42bfe1ull,
+  0x6b5565bb980f3076ull, 0x9ce63c76eb8c4c4aull, 0x3da24c53b9e4c771ull,
+  0xb50e3c666f0266faull, 0x01bb4b9676e34f79ull, 0x0fbea1249948cf3eull,
+  0xa1fa4edc86bead12ull, 0xc3b97bf9d11e901cull, 0x370ca58e71730e03ull,
+  0x886467e248b19715ull, 0x3c727e24db237497ull, 0x8e67d76e2116ccd2ull,
+  0x34bdedd3f973aecfull, 0xb042ab0531d680ecull, 0xfc5c3c17770e96a0ull,
+  0xb8204eceab6f1874ull, 0x416c0ced5843f3a5ull, 0x9578018311dd112full,
+  0x7e0e8613b1c74bd8ull, 0xa79ffc1096c6453bull, 0xfcd6da0ab2157651ull,
+  0x3dd0ccac836a34a7ull, 0x496049ed316e5a36ull, 0xdea1a97d0322bcb2ull,
+  0x39578d53cdf2aa5aull, 0x030565c91d1aa931ull, 0x324e0a27d198cbedull,
+  0x284325345db83e8aull, 0x5cb134c090bf23e8ull, 0x009e5051dd0adab6ull,
+  0x7e36a6d7f8ad61daull, 0xbdffe6aa84c75e57ull, 0x138d680eb5d5532eull,
+  0x4a5f74a1bd84ddacull, 0x55538cfaccff00d1ull, 0x48528011b0948b8cull,
+  0x9e047ad7e345f82eull, 0xea77bef06ee770ffull, 0x2f1625670fc13669ull,
+  0x0614686c869426acull, 0x4263ed823a3ff464ull, 0x57205a7ab3589b47ull,
+  0xae6fc46b213f24adull, 0xd92b133f3de03e4eull, 0x1b49c24a315a589bull,
+  0x1641c13873381bcbull, 0xbc680ada7bc99425ull, 0x962e9884a5cfbc9aull,
+  0xfc8d12f60a960d70ull, 0x60acc868ed18ef4cull, 0x131130369aea5d14ull,
+  0x2d99a5b0c747c87eull, 0x006b36583a369bb3ull, 0xe43fa6e6118a5135ull,
+  0xa13dc05eb4947190ull, 0x0dbd7170d7733db8ull, 0x117ed7e7c3fb67d1ull,
+  0xc05fe99ee2d72a49ull, 0xd971a25b9638db40ull, 0x1a1595594239d468ull,
+  0xc1117392850a223cull, 0x567b5fc022d2dbd8ull, 0xc051007a92c5b4ebull,
+  0xfb35572011cc0099ull, 0x398481616907810dull, 0x61d19ef25e8534f4ull,
+  0x8a0ab03c2ee8c466ull, 0x879aa514c234af76ull, 0x59e5da579774a235ull,
+  0xf339bd5a9bc466b3ull, 0xbbb5fd6744ab026dull, 0x3685c9f22b977202ull,
+  0x7054359e03e5dc00ull, 0x9ba11f085239cfb0ull, 0x9c258687f8237562ull,
+  0x52c7bf8fa3b510ddull, 0x3245e079b31ed0cfull, 0xbaee38c7ff9ff8d3ull,
+  0xf702b3b9f17d5562ull, 0xcbca275dcc4c8563ull, 0xe817dbace005d9d1ull,
+  0x62cee35005c6920aull, 0x19e049b90f1deac0ull, 0xb2a27a1659599f74ull,
+  0x7dcef00df0911d5aull, 0x375522513603dd66ull, 0x5fa022da97813735ull,
+  0xefbe57c20d849416ull, 0x5761929630a0e592ull, 0x11735043c953cc47ull,
+  0xc0444be0a83526adull, 0x16ff5136b5f8463cull, 0xf037572c2a0a6631ull,
+  0xb1bf8daad30464daull, 0x0f3e9e7e7f5718f7ull, 0xc26f2624e5a4cfe7ull,
+  0xdfe8f4858c9b5ae4ull, 0xc64a1509f6fa82e3ull, 0x3024b220acb24aeaull,
+  0xddcdfeddddb02ac0ull, 0x384c86c3d834c574ull, 0xdd48a571d904e099ull,
+  0x77b35c744550a05full, 0xaaebdc6d81e85f71ull, 0xd4cdc0540f9bb0b1ull,
+  0x845786af7af4df85ull, 0xdf2a91cae5e53887ull, 0x5689a3c4f6a58211ull,
+  0xa705983a8cf6aa15ull, 0x2ce7fef09fbf2f52ull, 0x4a3b536548e84a62ull,
+  0xd48a0872f8281a47ull, 0xf0929c3e8423dcf6ull, 0xe9ec071b044a5049ull,
+  0x20e30c1b17decc36ull, 0x3342196a45fc2813ull, 0x6601e33746afb7f9ull,
+  0xf18094d130754439ull, 0x61410dd1d38b4112ull, 0xd97d4dd8d8796b36ull,
+  0x8080519147e9bc0bull, 0xcde438c11584e2daull, 0x409659a1955d24f1ull,
+  0x5a09635f1b0950b1ull, 0x615472b965b1febeull, 0x6308e067525dc00aull,
+  0xd4e705a44089e2d4ull, 0x32c18b2643fc9209ull, 0xaf2711534447a5faull,
+  0x4dc4f0d23617cadcull, 0x6aa116ef692eb386ull, 0x0641dc0b655991bcull,
+  0xc655966454469597ull, 0x4bdc0d1a749c0fe8ull, 0xc5292a61a7d3381eull,
+  0x42474cc24eb65fdcull, 0x19dfc9eef2c6b173ull, 0xbece2ee30a19a199ull,
+  0xaa03aa7cc68b778dull, 0xae54d2bec8db86f0ull, 0xdee3f48fb92a01e0ull,
+  0xf6ae28526023c0a9ull, 0xa441cb9ea233763bull, 0x3a8bb4b73246ddddull,
+  0x308ef2c844faa3c3ull, 0xd2862534fd1c8516ull, 0x62336f6f3b25ebe7ull,
+  0x0b8e2ce60c336a45ull, 0x11eea1f2e867f171ull, 0x68df4903523972ecull,
+  0x51ef4cb750c05824ull, 0x3ffae115cb4df2a8ull, 0x3ed1635fb51aca2full,
+  0x0a5ac09fd6ff1cc6ull, 0x0a3dc76fde8ed9d6ull, 0x37991dde5dc2d8ddull,
+  0x80ad6e13f95bacb2ull, 0xd4f8c7a6163005eeull, 0xa4760f083225d180ull,
+  0x9b2b1a875fff004dull, 0x5cd00b66e7ea8576ull, 0x285dd80dec478452ull,
+  0x4301b3a120112439ull, 0xfacbb68cff879fc8ull, 0xb17fdf84af6af6b8ull,
+  0xf4489576c208d9f1ull, 0xadcc862c8794a6e9ull, 0x931685a40e83e54cull,
+  0x1e40293bab01c580ull, 0x1f1ddf7fcad784faull, 0xcee722b26b856084ull,
+  0x74254eb41c39938bull, 0xb9c26d9ac7ccebf4ull, 0x2e3ece246b08dfb9ull,
+  0xdff60410981455ecull, 0xe06fa38bbc804e2bull, 0x72e53c52b534540cull,
+  0xb2a5c05a02dfb2efull, 0x973133385002a2a5ull, 0xd61df455597c53ffull,
+  0x39ac2ec534e5261aull, 0x388b7539c6bc0cabull, 0x00eac7043f732fc0ull,
+  0xc089971e92fb21d9ull, 0x7af93f8fb4ffa503ull, 0xa8311b2372e353b6ull,
+  0x1de496ca8266c9afull, 0xd6fa0b51dbdb16b0ull, 0xbd5630899991a5efull,
+  0x0954a1e3168cbe0full, 0x53d09723537b9245ull, 0x86558cb92867272dull,
+  0xfac85d100b83f026ull, 0x1e5ddb95f8562951ull, 0x48d27b92ad3668c8ull,
+  0x19b58a99c930b7e6ull, 0xa9cda917a3de74e3ull, 0x7a4dd16ecb6e35eeull,
+  0x4d84073f4c80e9d5ull, 0x9cffcfc074a95ba8ull, 0x15796372d28485ebull,
+  0x77eda8df5717e9cdull, 0xadb965e1ab473c4eull, 0x5bc05659ffad6959ull,
+  0xfb2402276ed63880ull, 0xd15fdddf2014850bull, 0xb538f37dfdd74592ull,
+  0x1473396f3a8e2e82ull, 0x3ce41a21f6a5edf8ull, 0x754e82640cc4351aull,
+  0xc7821b96aab95e73ull, 0xc242faaaf42ff463ull, 0x087e260edd00ac65ull,
+  0x0dbe032817d193f5ull, 0xf9d10f96844a63c9ull, 0xbaf127ec85aa91ddull,
+  0xce85e6a50ab6dabbull, 0xe7b56a161af5d24full, 0x57d1d79fcd6c5a19ull,
+  0xec4dd2f05dfc2b28ull, 0x8d72216a18fe64a1ull, 0x72f14a085f222077ull,
+  0x3bf038abd8b09b11ull, 0xc4265d7cc6cf1f44ull, 0x46398d2cdab1b0e7ull,
+  0xb6e705d37dcfdc68ull, 0x362c11834aafd1e6ull, 0xf6ac98b7d8701107ull,
+  0xd6649424ad114d7eull, 0xddd1c6e4c40ab551ull, 0xc9d284c8a132030full,
+  0x824069eedb1f662aull, 0xc846b3ad4157904bull, 0x0a248c17d38481caull,
+  0xe8745febc846831full, 0x00000000000025a8ull,
+
+# define TENS_P14_IDX	(TENS_P13_IDX + TENS_P13_SIZE)
+# define TENS_P14_SIZE	852
+  [TENS_P14_IDX] = 0x0000000000000000ull, 0x0000000000000000ull,
+  0x0000000000000000ull, 0x0000000000000000ull, 0x0000000000000000ull,
+  0x0000000000000000ull, 0x0000000000000000ull, 0x0000000000000000ull,
+  0x0000000000000000ull, 0x0000000000000000ull, 0x0000000000000000ull,
+  0x0000000000000000ull, 0x0000000000000000ull, 0x0000000000000000ull,
+  0x0000000000000000ull, 0x0000000000000000ull, 0x0000000000000000ull,
+  0x0000000000000000ull, 0x0000000000000000ull, 0x0000000000000000ull,
+  0x0000000000000000ull, 0x0000000000000000ull, 0x0000000000000000ull,
+  0x0000000000000000ull, 0x0000000000000000ull, 0x0000000000000000ull,
+  0x0000000000000000ull, 0x0000000000000000ull, 0x0000000000000000ull,
+  0x0000000000000000ull, 0x0000000000000000ull, 0x0000000000000000ull,
+  0x0000000000000000ull, 0x0000000000000000ull, 0x0000000000000000ull,
+  0x0000000000000000ull, 0x0000000000000000ull, 0x0000000000000000ull,
+  0x0000000000000000ull, 0x0000000000000000ull, 0x0000000000000000ull,
+  0x0000000000000000ull, 0x0000000000000000ull, 0x0000000000000000ull,
+  0x0000000000000000ull, 0x0000000000000000ull, 0x0000000000000000ull,
+  0x0000000000000000ull, 0x0000000000000000ull, 0x0000000000000000ull,
+  0x0000000000000000ull, 0x0000000000000000ull, 0x0000000000000000ull,
+  0x0000000000000000ull, 0x0000000000000000ull, 0x0000000000000000ull,
+  0x0000000000000000ull, 0x0000000000000000ull, 0x0000000000000000ull,
+  0x0000000000000000ull, 0x0000000000000000ull, 0x0000000000000000ull,
+  0x0000000000000000ull, 0x0000000000000000ull, 0x0000000000000000ull,
+  0x0000000000000000ull, 0x0000000000000000ull, 0x0000000000000000ull,
+  0x0000000000000000ull, 0x0000000000000000ull, 0x0000000000000000ull,
+  0x0000000000000000ull, 0x0000000000000000ull, 0x0000000000000000ull,
+  0x0000000000000000ull, 0x0000000000000000ull, 0x0000000000000000ull,
+  0x0000000000000000ull, 0x0000000000000000ull, 0x0000000000000000ull,
+  0x0000000000000000ull, 0x0000000000000000ull, 0x0000000000000000ull,
+  0x0000000000000000ull, 0x0000000000000000ull, 0x0000000000000000ull,
+  0x0000000000000000ull, 0x0000000000000000ull, 0x0000000000000000ull,
+  0x0000000000000000ull, 0x0000000000000000ull, 0x0000000000000000ull,
+  0x0000000000000000ull, 0x0000000000000000ull, 0x0000000000000000ull,
+  0x0000000000000000ull, 0x0000000000000000ull, 0x0000000000000000ull,
+  0x0000000000000000ull, 0x0000000000000000ull, 0x0000000000000000ull,
+  0x0000000000000000ull, 0x0000000000000000ull, 0x0000000000000000ull,
+  0x0000000000000000ull, 0x0000000000000000ull, 0x0000000000000000ull,
+  0x0000000000000000ull, 0x0000000000000000ull, 0x0000000000000000ull,
+  0x0000000000000000ull, 0x0000000000000000ull, 0x0000000000000000ull,
+  0x0000000000000000ull, 0x0000000000000000ull, 0x0000000000000000ull,
+  0x0000000000000000ull, 0x0000000000000000ull, 0x0000000000000000ull,
+  0x0000000000000000ull, 0x0000000000000000ull, 0x0000000000000000ull,
+  0x0000000000000000ull, 0x0000000000000000ull, 0x0000000000000000ull,
+  0x0000000000000000ull, 0x0000000000000000ull, 0x0000000000000000ull,
+  0x0000000000000000ull, 0x0000000000000000ull, 0x0000000000000000ull,
+  0x0000000000000000ull, 0x0000000000000000ull, 0x0000000000000000ull,
+  0x0000000000000000ull, 0x0000000000000000ull, 0x0000000000000000ull,
+  0x0000000000000000ull, 0x0000000000000000ull, 0x0000000000000000ull,
+  0x0000000000000000ull, 0x0000000000000000ull, 0x0000000000000000ull,
+  0x0000000000000000ull, 0x0000000000000000ull, 0x0000000000000000ull,
+  0x0000000000000000ull, 0x0000000000000000ull, 0x0000000000000000ull,
+  0x0000000000000000ull, 0x0000000000000000ull, 0x0000000000000000ull,
+  0x0000000000000000ull, 0x0000000000000000ull, 0x0000000000000000ull,
+  0x0000000000000000ull, 0x0000000000000000ull, 0x0000000000000000ull,
+  0x0000000000000000ull, 0x0000000000000000ull, 0x0000000000000000ull,
+  0x0000000000000000ull, 0x0000000000000000ull, 0x0000000000000000ull,
+  0x0000000000000000ull, 0x0000000000000000ull, 0x0000000000000000ull,
+  0x0000000000000000ull, 0x0000000000000000ull, 0x0000000000000000ull,
+  0x0000000000000000ull, 0x0000000000000000ull, 0x0000000000000000ull,
+  0x0000000000000000ull, 0x0000000000000000ull, 0x0000000000000000ull,
+  0x0000000000000000ull, 0x0000000000000000ull, 0x0000000000000000ull,
+  0x0000000000000000ull, 0x0000000000000000ull, 0x0000000000000000ull,
+  0x0000000000000000ull, 0x0000000000000000ull, 0x0000000000000000ull,
+  0x0000000000000000ull, 0x0000000000000000ull, 0x0000000000000000ull,
+  0x0000000000000000ull, 0x0000000000000000ull, 0x0000000000000000ull,
+  0x0000000000000000ull, 0x0000000000000000ull, 0x0000000000000000ull,
+  0x0000000000000000ull, 0x0000000000000000ull, 0x0000000000000000ull,
+  0x0000000000000000ull, 0x0000000000000000ull, 0x0000000000000000ull,
+  0x0000000000000000ull, 0x0000000000000000ull, 0x0000000000000000ull,
+  0x0000000000000000ull, 0x0000000000000000ull, 0x0000000000000000ull,
+  0x0000000000000000ull, 0x0000000000000000ull, 0x0000000000000000ull,
+  0x0000000000000000ull, 0x0000000000000000ull, 0x0000000000000000ull,
+  0x0000000000000000ull, 0x0000000000000000ull, 0x0000000000000000ull,
+  0x0000000000000000ull, 0x0000000000000000ull, 0x0000000000000000ull,
+  0x0000000000000000ull, 0x0000000000000000ull, 0x0000000000000000ull,
+  0x0000000000000000ull, 0x0000000000000000ull, 0x0000000000000000ull,
+  0x0000000000000000ull, 0x0000000000000000ull, 0x0000000000000000ull,
+  0x0000000000000000ull, 0x0000000000000000ull, 0x0000000000000000ull,
+  0x0000000000000000ull, 0x0000000000000000ull, 0x0000000000000000ull,
+  0x0000000000000000ull, 0x0000000000000000ull, 0x0000000000000000ull,
+  0x0000000000000000ull, 0x0000000000000000ull, 0x0000000000000000ull,
+  0x0000000000000000ull, 0x0000000000000000ull, 0x0000000000000000ull,
+  0x0000000000000000ull, 0x0000000000000000ull, 0x0000000000000000ull,
+  0x0000000000000000ull, 0x0000000000000000ull, 0x0000000000000000ull,
+  0x0000000000000000ull, 0x0000000000000000ull, 0x0000000000000000ull,
+  0x0000000000000000ull, 0x0000000000000000ull, 0x0000000000000000ull,
+  0x0000000000000000ull, 0x0000000000000000ull, 0x0000000000000000ull,
+  0x41b5687d099f0001ull, 0x8c75ee63cbfd1b6eull, 0xd75296ad4b191ceaull,
+  0x1eb5da9b2394d80aull, 0x5c79fed918a004edull, 0xed67a1b837e3b01cull,
+  0x2a1a34d578d9a714ull, 0x6b1d35168fbe7f0dull, 0xa7825681e57c43eaull,
+  0xd3e716e1c81d32e8ull, 0xa6d93d6558860b00ull, 0x0113232f83159c97ull,
+  0x7321c3a0d6122269ull, 0xca4ca9d3be6a92f3ull, 0xc0e55163d1e276a5ull,
+  0x7b7a78c1b05915d6ull, 0x62a3df4b0fae0ca4ull, 0x13030d1108abec6full,
+  0x60dcc8f2d446338aull, 0x25e1f9f65f05d1d5ull, 0x7f8c711304a40beeull,
+  0x589ff59a88f47ec0ull, 0xea5068a1308c3661ull, 0x06e87dff95fb108full,
+  0xd4d4abdc1559e741ull, 0xee16907c01e092e4ull, 0xe73aabcb5a7b78e6ull,
+  0xad372889146bb7e0ull, 0xfd49fc1d4f6b43c5ull, 0xd37392530f29f589ull,
+  0xe2acfcc2c4745a56ull, 0xedd016cdd75ccbc7ull, 0xef82ccd3ac5a63e0ull,
+  0x2bdabfc4b352496eull, 0x01b0197f5b3d0401ull, 0x29d9253dade96d3cull,
+  0x73c56b1b19bebdbaull, 0x1f2b7f1e255e7b25ull, 0x6299c836a56a457eull,
+  0xa2ca74c65c63cc78ull, 0xee571bea5c85fe93ull, 0x2db5f1d0508e2561ull,
+  0xa9b87b99b1fde6a9ull, 0xf7260f074fb90a37ull, 0x56ee7e97ff58c5fdull,
+  0x42e6f9cebab9fa46ull, 0x1b76d26778816f73ull, 0x4566519cfdb2c728ull,
+  0xb9f6a95fae17dd8dull, 0x67160dea1cd533a1ull, 0xfcd8f8f914534bacull,
+  0x708b1f0af3f2901dull, 0x9457a1df8829063bull, 0x36bb93358f872aa1ull,
+  0xd889d109b5672c0eull, 0x933066727ec63a6aull, 0x8239ab6839b6d457ull,
+  0xbe0d7a1fef2e2506ull, 0x05f655224251b635ull, 0x032868910ef0bd55ull,
+  0x9815fbac2c42b664ull, 0x814e379c471fd611ull, 0xa4a25bda7dd8349dull,
+  0x01b9e39d9886b84cull, 0xae31cbc95a7ce1a2ull, 0x83ef8faf86d07f32ull,
+  0x58470fdfb66b5b76ull, 0x5161888996d59b73ull, 0xfc8e0fc6dc400cf7ull,
+  0x09a08e56af693670ull, 0x74f682e191737de6ull, 0x7f8ac56d0e03923full,
+  0x8e05e49a7400cfd4ull, 0x384e11644cebea3cull, 0xb50ae05eb2e43d8cull,
+  0xa40061230f0b3ed9ull, 0x4e9a193464137137ull, 0xd9621be605404100ull,
+  0x5c347ebb9329a255ull, 0xe684346b75cbeb1bull, 0xba6a9753840fee55ull,
+  0x60505b7bf43836f6ull, 0xfd6d475d334a9278ull, 0x267375aa5db94761ull,
+  0x024f6d63c110e160ull, 0xa99b4c192ec96610ull, 0x338cfd90b915c9f4ull,
+  0xb9e51a09f02ea846ull, 0xfae31d88ae928fb1ull, 0x8475dd261a3db721ull,
+  0x7ad4c4075769489dull, 0x34e275c80a49e9f0ull, 0x1d63114a3d075d83ull,
+  0x6b98e94772a96415ull, 0xd50fdc361d500b5full, 0x87751275141e5085ull,
+  0x2278809ee7843834ull, 0x947aead2b15c52eeull, 0x5197b744fedb7b02ull,
+  0x8849d0a664e09ba8ull, 0x11ecb91323beaa85ull, 0x5d9848480f7ed667ull,
+  0x588290e99f6331eaull, 0x7e09e9e5a24d64d1ull, 0x03a501df32592033ull,
+  0xbb3df73827c270a6ull, 0x4190833c3c7c5a70ull, 0x80e5d89b7d4bf9f4ull,
+  0xfaefb663a7fc6194ull, 0xd3b6adcd62e52b49ull, 0x1f2cf73a809646fcull,
+  0x531e4bfbb765ed4full, 0xaf12d1a692cd05f2ull, 0x38da107422ee30f3ull,
+  0x1a725608ed6447bbull, 0x7a3c6f54aff222d3ull, 0x7b0e8d12bca79a56ull,
+  0x6e34d6fb1c4660c5ull, 0xfe9dc99c6f481a9full, 0xd8489ea0f888db82ull,
+  0xc0dea28184b4c0faull, 0xae30e887977a8583ull, 0x1d4848cb8c1cbcecull,
+  0xd011b0fc0ee0d137ull, 0x478d7dd494b5fd49ull, 0xacab62ad3d67f2e7ull,
+  0x1dfc7df50ab4e62aull, 0x870b0e75d22e4553ull, 0x1b73bf6d49b7b001ull,
+  0xdc9f073712807ffdull, 0xc0e2f2506f3e5852ull, 0x4d96a55a93e62e4aull,
+  0x83a126dbc1d0e185ull, 0xefbfd043190b917bull, 0x8f25b6ddc7df1669ull,
+  0x476c17a62062eac9ull, 0x25460383cb60f278ull, 0xda8c05be0e85e996ull,
+  0x692062346f678a34ull, 0x1947b69af59be929ull, 0x90fd83220ebfa11bull,
+  0xd699b1ec15c1e9bfull, 0x7001d002b2f0343full, 0xc0778ab5cf76eaaaull,
+  0xb7b008e25173eda8ull, 0x505d3f4d4e00e4c6ull, 0x1c9d4e1299dd341aull,
+  0x474c5e954ffb6978ull, 0xda19f9386e9ca6ddull, 0x98dc318ee2dda6e0ull,
+  0x3f67b836da455e54ull, 0xa97e9a6421e4181cull, 0x527a08bb1e17f655ull,
+  0x682972ad1712dc21ull, 0xccbeadf10042d256ull, 0x861e99e0ca497b96ull,
+  0xeeb0f6500d8aa585ull, 0x506af77edcc3c3daull, 0x7c9d60be5deb9768ull,
+  0x37b37e95e9d978b7ull, 0x42747f7577ad0b94ull, 0x6d5fd2fe07be42c4ull,
+  0x0d8fc27d4c8c5da9ull, 0x0ccf60230f2fd50full, 0x3b1101bd5b56053full,
+  0xc0feca2756d34906ull, 0xc4888da47602a150ull, 0x56d10633419abe54ull,
+  0x8db14123c76120edull, 0x741e8f76b656e675ull, 0x96be6f21d297b94eull,
+  0x9b409e273662439dull, 0x35fff92a6626574dull, 0x69e02439bf558205ull,
+  0x6400fd4cbe6838b7ull, 0x1f4b158aa00f64caull, 0x04cca5589e2052aeull,
+  0x58da644cfb5ee69eull, 0x8ab1940196f26e1full, 0xed8bf908bee1e16bull,
+  0xd50babab2f2809a4ull, 0x6b0a89296e57f7e6ull, 0xb54a4cfcf7356431ull,
+  0x6f9fd6cb9a1d0ac4ull, 0x3b42f469836bfbf8ull, 0x40111b6b8bd32129ull,
+  0xb345d9557c278fb1ull, 0xd32cd13cff1fd188ull, 0x3789f792f7ec3aa0ull,
+  0x4d79a4bfab707fa4ull, 0xd9c24d8eb3a28cebull, 0x06e2eb3e7134dadcull,
+  0xb379d811d7c04f76ull, 0x8c94fc332b3b0ebcull, 0xc06c5d01a28b53abull,
+  0x7fea91cad900432aull, 0x64845f086d30b008ull, 0xfde4687d796f5349ull,
+  0xe0046c56f888fe67ull, 0xce98cb11ae482177ull, 0x1feb440084590c46ull,
+  0xff2f16116e1ba29bull, 0x3159ca8cf73f3e9cull, 0x56f0ed4634845918ull,
+  0xd9a16a01b7d10c32ull, 0x3cee3e24405b9e91ull, 0x2ab396b48739e4a6ull,
+  0x09835dfd3f1b7871ull, 0x1592b74a8c7a489full, 0x0e8d3f3705df7c81ull,
+  0x68b29622a61ff273ull, 0x43ff84a6259cd337ull, 0x566ed88381cf8fe9ull,
+  0x35c7942848427fc6ull, 0xa97e8c8bcfd2fb59ull, 0x32ddca23750aaed8ull,
+  0x96fbfff9aa8108efull, 0xe3cdf588a1d039aaull, 0xcd6b3fdb47e77e00ull,
+  0x9a522152e72a9a80ull, 0xef175610eda06283ull, 0x339fe6c4a670cfa1ull,
+  0xc2d7f53b2dfbf3eeull, 0xcc47e4b092a44e27ull, 0xd64f83c9dfa212bcull,
+  0xb51319bf997e5475ull, 0x1fc2c7b69fffe599ull, 0x832169ddef5605e7ull,
+  0xbf921dc8feb6be4eull, 0x72759f8d60bdfb1dull, 0x020eebed3546efa0ull,
+  0xdb20a2fecaab3d64ull, 0xb2b62bddba1218f6ull, 0x8fde5cfa3101eff0ull,
+  0xa52114d22e319213ull, 0xdf08b1dd87eead3full, 0x746f34d0a5387642ull,
+  0x4cc40317d76c4844ull, 0xb7d76071e4f689c9ull, 0x6e1c79155fe0b4a2ull,
+  0x3efb7d71c7d43f53ull, 0x35a75f5f068dd906ull, 0x750f4607652d7770ull,
+  0x36c2cf8e64a1656cull, 0x9348ef93214d758bull, 0x9674b7f3e4058978ull,
+  0xbdfaba8f10570b0bull, 0xa92b261fcef09dd7ull, 0xcbebb81f071c21b6ull,
+  0x44228cd6f427ed6cull, 0x5036c46065e56fcfull, 0xccfd848bad919defull,
+  0x7527dca361d158a6ull, 0x508550754cf30459ull, 0x3540f5aaa70dfd09ull,
+  0xb5ba3d4e35577adbull, 0xcdfb689f35736c4full, 0x97ab0dcaefe8fa82ull,
+  0x77a7fe9c51bd2ff3ull, 0x3d618b813107846cull, 0xfc5e9651bca797a4ull,
+  0xf7e8791fe2e08fbcull, 0x7c426f9d772f1cc0ull, 0x0080c3ab08d56f88ull,
+  0xe6d46ec60deea663ull, 0x6b681d9d7dca4eb7ull, 0x4af0e0f2da06730bull,
+  0x52097463038bf468ull, 0xbc09bb9aca19d302ull, 0x3ded4433aa55aeb1ull,
+  0x3e4b7865f27938baull, 0x7ef9631428296be7ull, 0xdf0b6b477a1d55ccull,
+  0xcedda5bdcde11852ull, 0x72ca1a8bf00a0eb3ull, 0xb002fdcc5241b572ull,
+  0xc4878862ff8898b3ull, 0xbf4bca29b3e85372ull, 0xf2d831897e1fef45ull,
+  0x3cdf9e050f5427afull, 0xf65c06ac75bae885ull, 0xa3145eac9c71a700ull,
+  0x76255bbfde63bab2ull, 0x4c6ad3d06e817be6ull, 0xe95ef2f825ab9935ull,
+  0xd54f78de11cd095aull, 0xb3829dcba001ae7eull, 0x18eb9c9e5abd18bdull,
+  0xe3e3556cada3c504ull, 0x5191ac5fd35479aaull, 0xc8d1d9d3221821acull,
+  0x088c3fc8313a8c51ull, 0xb154abedc146a264ull, 0x349ec09392755bc5ull,
+  0x41d5886cf94aba57ull, 0x36aba94b0a5ad8b2ull, 0xa9ad229f883a6758ull,
+  0x0546172f5d64069aull, 0xc3808ea40366da16ull, 0x70f0a2350b172403ull,
+  0x4fceb827fa816e66ull, 0x167b56d5a65fcfeaull, 0xfec36bcdfe2b9fb2ull,
+  0xcd96320fa84c4cc9ull, 0x09eda8b83e128584ull, 0x7ec7e17b91eca525ull,
+  0xc14032f4bc45bedcull, 0x2eb20bc09be689a7ull, 0x14ef835fffdf1efcull,
+  0xcd778dd8c6966c59ull, 0x23d477155feb0f3bull, 0x5722a550d64b87c8ull,
+  0x315a1a8b62883198ull, 0x4b7e9d7a648e17e6ull, 0x67caca842ba43d28ull,
+  0x6e660159741f0398ull, 0x3dde3c453e16e1a9ull, 0xc7eb0aefa53e56aeull,
+  0x78751d733f39f33eull, 0x626770f745816df8ull, 0x909e87f4cb17d28dull,
+  0xc1dcf32893a86abaull, 0xd895d0421a1e4ce2ull, 0xbb00eaf5b9f6dd69ull,
+  0xca609578acc37687ull, 0xf8b86d4c5b490d39ull, 0x39419f6df2737ef0ull,
+  0x72524a0369267bc0ull, 0xdbc01e936eb060c4ull, 0x83984d54291035b1ull,
+  0xe08cbc20f673ad85ull, 0x584803a61fb24915ull, 0x4088ddb5e15bbcd7ull,
+  0x2c18041ad4c22542ull, 0xb2ba69b4a51372d1ull, 0xcd11c2962299283full,
+  0xac54df2325dcd6f3ull, 0x77e16e1d24a3a55eull, 0xb99d85c0b3cd415bull,
+  0xe91154e3497befc7ull, 0xb55100aa7365cd8bull, 0xfc0927a60ee699ebull,
+  0x8acaa910efb374deull, 0xda3f000683b40e3dull, 0xc6ce1b758590a089ull,
+  0xfda2f7f354f6ff20ull, 0xd0763b6dd2ab58f6ull, 0x2519622d6caf2515ull,
+  0x9863638fc3714057ull, 0x09ea4a4dea00bb4full, 0x6b01fe5fe69de96dull,
+  0x529e32ec960161a5ull, 0x01a37eeaf8260ae9ull, 0x5aa0716f69710577ull,
+  0x4260fedacb3fb1daull, 0x76012f75a33fb790ull, 0x130f09ae24c0e5beull,
+  0x5c8ecb762e8323dcull, 0x401b5f5c17cb8f12ull, 0x47e1560a5f0a63e0ull,
+  0xee1377d4dc57a786ull, 0x0aa294b9228e7ee5ull, 0x55b0fe2faea6c534ull,
+  0xf108b772922d318aull, 0xdfb69702f15bddf6ull, 0x90e1db66cd438a4eull,
+  0x568ef6cb584ce4a1ull, 0x6da376ba69e55f9dull, 0x45c7e2945ca6c109ull,
+  0xcf5b6c0cc977b3e9ull, 0x11b487ae1d694499ull, 0xbcb3cc6ecf8339acull,
+  0x046b107150b828e0ull, 0x2c6159465703ed0dull, 0xa908dbd0720d1610ull,
+  0x22c076e2742bbe33ull, 0x1d0cefa448966a66ull, 0x601352bf1dde819full,
+  0xa585cc4ab9370c39ull, 0x5a2f7206eb857f94ull, 0x49cd0f1f3fae6b58ull,
+  0x1b89d47678e5fb3dull, 0xed82945b74e9e65bull, 0x2941c4d9b74e6483ull,
+  0x565c18dc7e087accull, 0xbf4ccd3d1a09f2e5ull, 0xa522631dd304e977ull,
+  0x4517109b6123378eull, 0x4bf1a506b7e4285aull, 0x683172f8625803c2ull,
+  0x3f8a2b11c84e7354ull, 0xed4204917dd12b89ull, 0x9853fb978c698b0bull,
+  0xb697e1c99631777bull, 0x510381105f028f05ull, 0x30e255e39055f055ull,
+  0xb990321ee2d0c1b6ull, 0xff4dc144a8fdf4d1ull, 0x148999e0521a3056ull,
+  0xa9c96852a8111c66ull, 0x4b394a948157f508ull, 0x94ec2e93a0dc4df1ull,
+  0x8fc283776e6afa56ull, 0xc435186ff72ffa04ull, 0x8d037f6ff91488b7ull,
+  0x48757727a899ec1eull, 0xb8cf377d4101b612ull, 0xb4570569a5a54e68ull,
+  0x063d9cfd2ac5a0a0ull, 0xf1a5884c7c504c74ull, 0x8d0b91bf0a9b1955ull,
+  0x79ff5361e5f6862full, 0xc6fd31fb0ed3d38full, 0x85b9c6489fe131c7ull,
+  0x8e77e86b8febf2b4ull, 0x56429986992ba80eull, 0x608cdda56848879aull,
+  0x754b300e3e0d106eull, 0xafd5195b25200576ull, 0xe81f09395d37aad9ull,
+  0xdeeea20ae00a390eull, 0xb5d51155f5fef0beull, 0x9e72ebcf6e27d173ull,
+  0xb966f7bab776e978ull, 0x726c840809520238ull, 0x65dce5a23347ebc5ull,
+  0x8c92d7403ec78337ull, 0x32caec933cdde3feull, 0x411be811d20379aeull,
+  0x72fa1bbd41756580ull, 0x84c42f04a92125b3ull, 0x3a25922cdd4ee5feull,
+  0x49ad3be096446853ull, 0x1c841afe2880366dull, 0xfb905fe1f1e09019ull,
+  0x3ba9d0c9a451ad59ull, 0xa42419f256db2e9cull, 0x3c9a3ca5e921e7a0ull,
+  0xcec7d091ad8ea375ull, 0x477ef58f99bdb940ull, 0xb2598b8d8a4933c7ull,
+  0xcfac1e1cf5659df7ull, 0xe2a04aab339f8748ull, 0x45bc6f37e122b03full,
+  0x9c75aaa0c9feeb30ull, 0x0ea0585dc13c174eull, 0x3a96bd5adc58bbb4ull,
+  0x3c7a714d20251482ull, 0x6cb83b6b696897ebull, 0x3b496b5fa37de406ull,
+  0x380dd38237e75d6aull, 0xda26fac90e1a513cull, 0x12b5c6eaf2458364ull,
+  0x1ff1fcbf79ce9e47ull, 0x59a6a7babe7c6e86ull, 0x947614538d70f515ull,
+  0x8768ffb26b04e425ull, 0x3f9e84071ca5f425ull, 0x5f8f67563b641184ull,
+  0x56bc212062b1a5a5ull, 0x17f2fa18d1e5da68ull, 0xa1bc9c068cce5e2dull,
+  0x892df1af8e290fb1ull, 0xb43e5517ad10b8c8ull, 0x4407c38fd0597409ull,
+  0xfea9c9b64a020d81ull, 0xd5b2aaf9d8e0e7d6ull, 0xda44ed4ade5e9b40ull,
+  0x87aa3ca045d6bf41ull, 0x4708acc8c62d12fcull, 0x0d1227ff10212e26ull,
+  0x5da02550feeb5742ull, 0x1d56e5e1d66668e7ull, 0xae1e0bef32c215ecull,
+  0x58c0e9227f048b7eull, 0x58251aac2aea8619ull, 0xa1fea536bbe10425ull,
+  0xd233eb7d2e1d9667ull, 0xb0693c67cf435c0bull, 0x903ec9f061d918eaull,
+  0x0efb1788d6c4e8acull, 0x1709d878b0098f5bull, 0x3f6ce1b73c12b35eull,
+  0x8a8f7dbba1b3ff54ull, 0x73e8563e37608d6aull, 0x64e00749a3330540ull,
+  0x8d5caaf9ebbfcab9ull, 0xedb2bd943bc87c7eull, 0xe656dec322f8f62dull,
+  0x670c1626c5683222ull, 0x4237542f94089e7full, 0x2fc4e53047d29440ull,
+  0x8b288dac8419441eull, 0xa7afb4e97f9245f9ull, 0x082adef78a15650dull,
+  0x043c62de3104ef19ull, 0x7ecd06350aff3dc5ull, 0xe0600fade7e80a8bull,
+  0x81ebf4e04d8e81ccull, 0x7b372af7f587e30full, 0xdee11c6f2d8f8ca0ull,
+  0xf8adc426d3624b1cull, 0x5c22de4fca9debedull, 0xfae3186b3634f778ull,
+  0xd7bfa75facf8b595ull, 0xbbfe3cf6003cd316ull, 0xc51055a1b023cb50ull,
+  0x93869a770063cffdull, 0xfbceeb1051e022d4ull, 0x109defc95187457eull,
+  0xe13cfde2673892d8ull, 0xc09c8134d4aa3272ull, 0x0327181bbf89ad5bull,
+  0xaa21b63209511ec7ull, 0xe41885b5d7e72186ull, 0x493d278946713f9cull,
+  0xd5d22a5c1386c526ull, 0xcf59281ccefddfc4ull, 0x4ebe43f692973ea6ull,
+  0x6cf4897deac5c6adull, 0x82ce562ad95082a0ull, 0x28d8f0db28e5e9bdull,
+  0x707b0166ddf06e81ull, 0xfbf5756a7dae3f00ull, 0x4f114102035a4680ull,
+  0x5190fedfe7ba4b33ull, 0xe5f1bc49106a7594ull, 0xd7a1a766aae3ad67ull,
+  0x9120a214040ee971ull, 0x1edc87eaf415b374ull, 0xc6ad637d17aab43cull,
+  0xd90303c7885858c1ull, 0x3ff4eb0ebfd4b70bull, 0xd81eea30344a9a88ull,
+  0x5adef0ec95925446ull, 0x20bbd8c3abb5f5e7ull, 0xe6944262c1c22cceull,
+  0x80024021c5acdb23ull, 0x94b30c812232c635ull, 0x78569acd55f07648ull,
+  0x4dd6b5289696ea39ull, 0xde5853b31c3e1b40ull, 0x6eb5a7d88a2c3679ull,
+  0x8f9cf09656bda89aull, 0x6481c7e7fda86d5bull, 0x15bfb45d50a6a7d5ull,
+  0xc057d45d4f9a5381ull, 0xa0009f004fb10024ull, 0xac420f745e1ca0ddull,
+  0xf0d4a615cfbb38bdull, 0x0e3aef8419bf0318ull, 0x166c1e3ecb3d7b20ull,
+  0x3bfacf9f58272fddull, 0x63a13528c0f5ce46ull, 0xa020ca8cea59e333ull,
+  0x3dbb5a3daadd116bull, 0x747f55eae5523f47ull, 0x64d520fb0922171eull,
+  0x07ce951b6c709e84ull, 0x7508eb6d35fdc402ull, 0xb0d11c39c495a8faull,
+  0x57447ef081313d65ull, 0xf72301f3a7b61e26ull, 0x45a3a7c5bb096315ull,
+  0x00432f88a903a44bull, 0xeb4e1b6619081987ull, 0x6d245171bb7b66bdull,
+  0x0d89bd0bde4182f5ull, 0xf70d8a6087f4de6cull, 0x08a274499a87855bull,
+  0xd49640174ac7720aull, 0x4db3488cb0d9ddacull, 0xd07b745bfe397d44ull,
+  0x6e9d567d197dcb7bull, 0x9143fef1e3b90812ull, 0x115ff96db9e002acull,
+  0x5b61c9c8f60a2201ull, 0xb14a44a709abab2full, 0x843c79970ca19c73ull,
+  0x5e3fc18ce3a9bbe6ull, 0x764df59d0c0404eeull, 0x4ad0ba3c990ec2c2ull,
+  0xe599647d05e8be0full, 0x4d0c2990c19d365dull, 0xb680a72de5a9d9acull,
+  0x6d6c02674ce2e5ddull, 0xbd6078e006f9c25bull, 0xd742fa41b5fcdc81ull,
+  0xc691adc0cccc2399ull, 0xea73b0c3215ad82cull, 0xf499e0a6a511e5b0ull,
+  0xd94440a253e27ab0ull, 0x9a6e364447752521ull, 0x8f8b301dab113708ull,
+  0x00000000058a42a3ull,
 #endif
 };
 
@@ -439,7 +1306,7 @@ const mp_limb_t __tens[] =
 /* Each of array variable above defines one mpn integer which is a power of 10.
    This table points to those variables, indexed by the exponent.  */
 
-const struct mp_power _fpioconst_pow10[FLT128_MAX_10_EXP_LOG + 1] =
+const struct mp_power _fpioconst_pow10[FPIOCONST_POW10_ARRAY_SIZE] =
 {
   { TENS_P0_IDX, TENS_P0_SIZE,		4,	     },
   { TENS_P1_IDX, TENS_P1_SIZE,		7,	   4 },
@@ -450,14 +1317,12 @@ const struct mp_power _fpioconst_pow10[FLT128_MAX_10_EXP_LOG + 1] =
   { TENS_P6_IDX, TENS_P6_SIZE,		213,	 210 },
   { TENS_P7_IDX, TENS_P7_SIZE,		426,	 422 },
   { TENS_P8_IDX, TENS_P8_SIZE,  	851,	 848 },
-#if FLT128_MAX_EXP > 1024
   { TENS_P9_IDX, TENS_P9_SIZE,	 	1701,	1698 },
   { TENS_P10_IDX, TENS_P10_SIZE,	3402,	3399 },
+#if FLT128_MAX_EXP > 1024
   { TENS_P11_IDX, TENS_P11_SIZE,	6804,	6800 },
-  { TENS_P12_IDX, TENS_P12_SIZE, 	13607, 13604 }
+  { TENS_P12_IDX, TENS_P12_SIZE,	13607,	13604 },
+  { TENS_P13_IDX, TENS_P13_SIZE,	27214,	27210 },
+  { TENS_P14_IDX, TENS_P14_SIZE,	54427,	54424 },
 #endif
 };
-
-#if LAST_POW10 > _LAST_POW10
-# error "Need to expand 10^(2^i) table for i up to" LAST_POW10
-#endif
diff --git a/libquadmath/printf/fpioconst.h b/libquadmath/printf/fpioconst.h
index 4187555..7b7a40a 100644
--- a/libquadmath/printf/fpioconst.h
+++ b/libquadmath/printf/fpioconst.h
@@ -35,6 +35,14 @@
 
 #define FLT128_MAX_10_EXP_LOG	12 /* = floor(log_2(FLT128_MAX_10_EXP)) */
 
+/* For strtoq, we need powers of 10 up to floor (log_2 (FLT128_MANT_DIG
+   - FLT128_MIN_EXP + 2)).  */
+#if !defined __NO_LONG_DOUBLE_MATH && FLT128_MAX_EXP > 1024
+# define FPIOCONST_POW10_ARRAY_SIZE    15
+#else
+# define FPIOCONST_POW10_ARRAY_SIZE    11
+#endif
+
 
 /* The array with the number representation. */
 #define __tens __quadmath_tens
@@ -50,7 +58,7 @@ struct mp_power
     int m_expo;			/* Exponent of the number 10^-(2^i-1).  */
   };
 #define _fpioconst_pow10 __quadmath_fpioconst_pow10
-extern const struct mp_power _fpioconst_pow10[FLT128_MAX_10_EXP_LOG + 1]
+extern const struct mp_power _fpioconst_pow10[FPIOCONST_POW10_ARRAY_SIZE]
      attribute_hidden;
 
 /* The constants in the array `_fpioconst_pow10' have an offset.  */
diff --git a/libquadmath/printf/printf_fp.c b/libquadmath/printf/printf_fp.c
index eb66372..63338f3 100644
--- a/libquadmath/printf/printf_fp.c
+++ b/libquadmath/printf/printf_fp.c
@@ -1,5 +1,5 @@
 /* Floating point output for `printf'.
-   Copyright (C) 1995-2003, 2006-2008, 2011 Free Software Foundation, Inc.
+   Copyright (C) 1995-2012 Free Software Foundation, Inc.
 
    This file is part of the GNU C Library.
    Written by Ulrich Drepper <drepper@gnu.ai.mit.edu>, 1995.
@@ -15,16 +15,17 @@
    Lesser General Public License for more details.
 
    You should have received a copy of the GNU Lesser General Public
-   License along with the GNU C Library; if not, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
+   License along with the GNU C Library; if not, see
+   <http://www.gnu.org/licenses/>.  */
 
 #include <config.h>
 #include <float.h>
+#include <limits.h>
 #include <math.h>
 #include <string.h>
 #include <unistd.h>
 #include <stdlib.h>
+#include <stdbool.h>
 #define NDEBUG
 #include <assert.h>
 #ifdef HAVE_ERRNO_H
@@ -32,6 +33,7 @@
 #endif
 #include <stdio.h>
 #include <stdarg.h>
+#include "quadmath-rounding-mode.h"
 #include "quadmath-printf.h"
 #include "fpioconst.h"
 
@@ -162,7 +164,8 @@ __quadmath_printf_fp (struct __quadmath_printf_file *fp,
   MPN_VAR(tmp);
 
   /* Digit which is result of last hack_digit() call.  */
-  wchar_t digit;
+  wchar_t last_digit, next_digit;
+  bool more_bits;
 
   /* The type of output format that will be used: 'e'/'E' or 'f'.  */
   int type;
@@ -370,11 +373,11 @@ __quadmath_printf_fp (struct __quadmath_printf_file *fp,
 	      special = "NAN";
 	      wspecial = L_("NAN");
 	    }
-	    else
-	      {
-		special = "nan";
+	  else
+	    {
+	      special = "nan";
 		wspecial = L_("nan");
-	      }
+	    }
 	}
       else if (isinfq (fpnum))
 	{
@@ -935,34 +938,31 @@ __quadmath_printf_fp (struct __quadmath_printf_file *fp,
       }
 
     /* Do rounding.  */
-    digit = hack_digit ();
-    if (digit > L_('4'))
+    last_digit = wcp[-1] != decimalwc ? wcp[-1] : wcp[-2];
+    next_digit =hack_digit ();
+
+    if (next_digit != L_('0') && next_digit != L_('5'))
+      more_bits = true;
+    else if (fracsize == 1 && frac[0] == 0)
+      /* Rest of the number is zero.  */
+      more_bits = false;
+    else if (scalesize == 0)
+      {
+	/* Here we have to see whether all limbs are zero since no
+	   normalization happened.  */
+	size_t lcnt = fracsize;
+	while (lcnt >= 1 && frac[lcnt - 1] == 0)
+	  --lcnt;
+	more_bits = lcnt > 0;
+      }
+    else
+      more_bits = true;
+    int rounding_mode = get_rounding_mode ();
+    if (round_away (is_neg, (last_digit - L_('0')) & 1, next_digit >= L_('5'),
+		    more_bits, rounding_mode))
       {
 	wchar_t *wtp = wcp;
 
-	if (digit == L_('5')
-	    && ((*(wcp - 1) != decimalwc && (*(wcp - 1) & 1) == 0)
-		|| ((*(wcp - 1) == decimalwc && (*(wcp - 2) & 1) == 0))))
-	  {
-	    /* This is the critical case.	 */
-	    if (fracsize == 1 && frac[0] == 0)
-	      /* Rest of the number is zero -> round to even.
-		 (IEEE 754-1985 4.1 says this is the default rounding.)  */
-	      goto do_expo;
-	    else if (scalesize == 0)
-	      {
-		/* Here we have to see whether all limbs are zero since no
-		   normalization happened.  */
-		size_t lcnt = fracsize;
-		while (lcnt >= 1 && frac[lcnt - 1] == 0)
-		  --lcnt;
-		if (lcnt == 0)
-		  /* Rest of the number is zero -> round to even.
-		     (IEEE 754-1985 4.1 says this is the default rounding.)  */
-		  goto do_expo;
-	      }
-	  }
-
 	if (fracdig_no > 0)
 	  {
 	    /* Process fractional digits.  Terminate if not rounded or
@@ -1056,7 +1056,6 @@ __quadmath_printf_fp (struct __quadmath_printf_file *fp,
 	  }
       }
 
-  do_expo:
     /* Now remove unnecessary '0' at the end of the string.  */
     while (fracdig_no > fracdig_min + added_zeros && *(wcp - 1) == L_('0'))
       {
@@ -1249,15 +1248,19 @@ guess_grouping (unsigned int intdig_max, const char *grouping)
       ++groups;
       intdig_max -= *grouping++;
 
-      if (*grouping == 0)
+      if (*grouping == CHAR_MAX
+#if CHAR_MIN < 0
+	  || *grouping < 0
+#endif
+	  )
+	/* No more grouping should be done.  */
+	break;
+      else if (*grouping == 0)
 	{
 	  /* Same grouping repeats.  */
 	  groups += (intdig_max - 1) / grouping[-1];
 	  break;
 	}
-      else if (*grouping == CHAR_MAX || *grouping <= 0)
-	/* No more grouping should be done.  */
-	break;
     }
 
   return groups;
@@ -1289,12 +1292,16 @@ group_number (wchar_t *buf, wchar_t *bufend, unsigned int intdig_no,
       while (--len > 0);
       *p-- = thousands_sep;
 
-      if (*grouping == 0)
-	/* Same grouping repeats.  */
-	--grouping;
-      else if (*grouping == CHAR_MAX || *grouping <= 0)
+      if (*grouping == CHAR_MAX
+#if CHAR_MIN < 0
+	  || *grouping < 0
+#endif
+	  )
 	/* No more grouping should be done.  */
 	break;
+      else if (*grouping == 0)
+	/* Same grouping repeats.  */
+	--grouping;
     } while (intdig_no > (unsigned int) *grouping);
 
   /* Copy the remaining ungrouped digits.  */
diff --git a/libquadmath/printf/printf_fphex.c b/libquadmath/printf/printf_fphex.c
index 941e933..5b78243 100644
--- a/libquadmath/printf/printf_fphex.c
+++ b/libquadmath/printf/printf_fphex.c
@@ -1,5 +1,5 @@
 /* Print floating point number in hexadecimal notation according to ISO C99.
-   Copyright (C) 1997-2002,2004,2006 Free Software Foundation, Inc.
+   Copyright (C) 1997-2012 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
 
@@ -14,17 +14,18 @@
    Lesser General Public License for more details.
 
    You should have received a copy of the GNU Lesser General Public
-   License along with the GNU C Library; if not, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
+   License along with the GNU C Library; if not, see
+   <http://www.gnu.org/licenses/>.  */
 
 #include <config.h>
 #include <math.h>
 #include <stdlib.h>
 #include <stdio.h>
 #include <string.h>
+#include <stdbool.h>
 #define NDEBUG
 #include <assert.h>
+#include "quadmath-rounding-mode.h"
 #include "quadmath-printf.h"
 #include "_itoa.h"
 #include "_itowa.h"
@@ -116,6 +117,8 @@ __quadmath_printf_fphex (struct __quadmath_printf_file *fp,
   /* Nonzero if this is output on a wide character stream.  */
   int wide = info->wide;
 
+  bool do_round_away;
+
   /* Figure out the decimal point character.  */
 #ifdef USE_NL_LANGINFO
   if (info->extra == 0)
@@ -274,8 +277,8 @@ __quadmath_printf_fphex (struct __quadmath_printf_file *fp,
       /* Fill with zeroes.  */
       while (numstr > numbuf + (sizeof numbuf - 112 / 4))
 	{
-	  *--numstr = '0';
 	  *--wnumstr = L_('0');
+	  *--numstr = '0';
 	}
 
       leading = fpnum.ieee.exponent == 0 ? '0' : '1';
@@ -316,21 +319,33 @@ __quadmath_printf_fphex (struct __quadmath_printf_file *fp,
 	  --numend;
 	}
 
+      do_round_away = false;
+
+      if (precision != -1 && precision < numend - numstr)
+	{
+	  char last_digit = precision > 0 ? numstr[precision - 1] : leading;
+	  char next_digit = numstr[precision];
+	  int last_digit_value = (last_digit >= 'A' && last_digit <= 'F'
+				  ? last_digit - 'A' + 10
+				  : (last_digit >= 'a' && last_digit <= 'f'
+				     ? last_digit - 'a' + 10
+				     : last_digit - '0'));
+	  int next_digit_value = (next_digit >= 'A' && next_digit <= 'F'
+				  ? next_digit - 'A' + 10
+				  : (next_digit >= 'a' && next_digit <= 'f'
+				     ? next_digit - 'a' + 10
+				     : next_digit - '0'));
+	  bool more_bits = ((next_digit_value & 7) != 0
+			    || precision + 1 < numend - numstr);
+	  int rounding_mode = get_rounding_mode ();
+	  do_round_away = round_away (negative, last_digit_value & 1,
+				      next_digit_value >= 8, more_bits,
+				      rounding_mode);
+	}
+
       if (precision == -1)
 	precision = numend - numstr;
-      else if (precision < numend - numstr
-	       && (numstr[precision] > '8'
-		   || (('A' < '0' || 'a' < '0')
-		       && numstr[precision] < '0')
-		   || (numstr[precision] == '8'
-		       && (precision + 1 < numend - numstr
-			   /* Round to even.  */
-			   || (precision > 0
-			       && ((numstr[precision - 1] & 1)
-				   ^ (isdigit (numstr[precision - 1]) == 0)))
-			   || (precision == 0
-			       && ((leading & 1)
-				   ^ (isdigit (leading) == 0)))))))
+      else if (do_round_away)
 	{
 	  /* Round up.  */
 	  int cnt = precision;
diff --git a/libquadmath/quadmath-generic-rounding-mode.h b/libquadmath/quadmath-generic-rounding-mode.h
new file mode 100644
index 0000000..92b5c48
--- /dev/null
+++ b/libquadmath/quadmath-generic-rounding-mode.h
@@ -0,0 +1,129 @@
+/* Determine floating-point rounding mode within libc.  Generic version.
+   Copyright (C) 2012 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <http://www.gnu.org/licenses/>.  */
+
+#ifndef QUADMATH_GENERIC_ROUNDING_MODE_H
+#define QUADMATH_GENERIC_ROUNDING_MODE_H	1
+
+#ifdef HAVE_FPU_CONTROL_H
+#  include <fpu_control.h>
+#elif defined (HAVE_HOST_CPU_X86)
+#  include "quadmath-x64-fpu_control.h"
+#else
+#  error Neither HAVE_FPU_CONTROL_H nor HAVE_HOST_CPU_X86 is set
+#endif
+
+/* Define values for FE_* modes not defined for this architecture.  */
+#ifdef FE_DOWNWARD
+# define ORIG_FE_DOWNWARD FE_DOWNWARD
+#else
+# define ORIG_FE_DOWNWARD 0
+#endif
+#ifdef FE_TONEAREST
+# define ORIG_FE_TONEAREST FE_TONEAREST
+#else
+# define ORIG_FE_TONEAREST 0
+#endif
+#ifdef FE_TOWARDZERO
+# define ORIG_FE_TOWARDZERO FE_TOWARDZERO
+#else
+# define ORIG_FE_TOWARDZERO 0
+#endif
+#ifdef FE_UPWARD
+# define ORIG_FE_UPWARD FE_UPWARD
+#else
+# define ORIG_FE_UPWARD 0
+#endif
+#define QMFE_CONSTRUCT_DISTINCT_VALUE(X, Y, Z) ((((X) & 1) | ((Y) & 2) | ((Z) & 4)) ^ 7)
+#ifndef FE_DOWNWARD
+# define FE_DOWNWARD QMFE_CONSTRUCT_DISTINCT_VALUE (ORIG_FE_TONEAREST,	\
+						  ORIG_FE_TOWARDZERO,	\
+						  ORIG_FE_UPWARD)
+#endif
+#ifndef FE_TONEAREST
+# define FE_TONEAREST QMFE_CONSTRUCT_DISTINCT_VALUE (FE_DOWNWARD,		\
+						   ORIG_FE_TOWARDZERO,	\
+						   ORIG_FE_UPWARD)
+#endif
+#ifndef FE_TOWARDZERO
+# define FE_TOWARDZERO QMFE_CONSTRUCT_DISTINCT_VALUE (FE_DOWNWARD,	\
+						    FE_TONEAREST,	\
+						    ORIG_FE_UPWARD)
+#endif
+#ifndef FE_UPWARD
+# define FE_UPWARD QMFE_CONSTRUCT_DISTINCT_VALUE (FE_DOWNWARD,	\
+						FE_TONEAREST,	\
+						FE_TOWARDZERO)
+#endif
+
+/* Return the floating-point rounding mode.  */
+
+static inline int
+get_rounding_mode (void)
+{
+#if (defined _FPU_RC_DOWN			\
+     || defined _FPU_RC_NEAREST			\
+     || defined _FPU_RC_ZERO			\
+     || defined _FPU_RC_UP)
+  fpu_control_t fc;
+  const fpu_control_t mask = (0
+# ifdef _FPU_RC_DOWN
+			      | _FPU_RC_DOWN
+# endif
+# ifdef _FPU_RC_NEAREST
+			      | _FPU_RC_NEAREST
+# endif
+# ifdef _FPU_RC_ZERO
+			      | _FPU_RC_ZERO
+# endif
+# ifdef _FPU_RC_UP
+			      | _FPU_RC_UP
+# endif
+			      );
+
+  _FPU_GETCW (fc);
+  switch (fc & mask)
+    {
+# ifdef _FPU_RC_DOWN
+    case _FPU_RC_DOWN:
+      return FE_DOWNWARD;
+# endif
+
+# ifdef _FPU_RC_NEAREST
+    case _FPU_RC_NEAREST:
+      return FE_TONEAREST;
+# endif
+
+# ifdef _FPU_RC_ZERO
+    case _FPU_RC_ZERO:
+      return FE_TOWARDZERO;
+# endif
+
+# ifdef _FPU_RC_UP
+    case _FPU_RC_UP:
+      return FE_UPWARD;
+# endif
+
+    default:
+      abort ();
+    }
+#else
+  return FE_TONEAREST;
+#endif
+}
+
+#endif /* get-rounding-mode.h */
diff --git a/libquadmath/quadmath-ia64-rounding-mode.h b/libquadmath/quadmath-ia64-rounding-mode.h
new file mode 100644
index 0000000..8f2d2f0
--- /dev/null
+++ b/libquadmath/quadmath-ia64-rounding-mode.h
@@ -0,0 +1,37 @@
+/* Return current rounding direction within libc.  IA64 version.
+   Copyright (C) 1999-2012 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Christian Boissat <Christian.Boissat@cern.ch>, 1999.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <http://www.gnu.org/licenses/>.  */
+
+#ifndef QUADMATH_IA64_ROUNDING_MODE_H
+#define QUADMATH_IA64_ROUNDING_MODE_H	1
+
+#include <fenv.h>
+
+/* Return the floating-point rounding mode.  */
+
+static inline int
+get_rounding_mode (void)
+{
+  fenv_t fpsr;
+
+  __asm__ __volatile__ ("mov.m %0=ar.fpsr" : "=r" (fpsr));
+
+  return (fpsr >> 10) & 3;
+}
+
+#endif /* get-rounding-mode.h */
diff --git a/libquadmath/quadmath-imp.h b/libquadmath/quadmath-imp.h
index 40b346b..0b600d3 100644
--- a/libquadmath/quadmath-imp.h
+++ b/libquadmath/quadmath-imp.h
@@ -27,16 +27,6 @@ Boston, MA 02110-1301, USA.  */
 #include "config.h"
 
 
-/* Under IEEE 754, an architecture may determine tininess of
-   floating-point results either "before rounding" or "after
-   rounding", but must do so in the same way for all operations
-   returning binary results.  Define TININESS_AFTER_ROUNDING to 1 for
-   "after rounding" architectures, 0 for "before rounding"
-   architectures.  */
-
-#define TININESS_AFTER_ROUNDING   1
-
-
 /* Prototypes for internal functions.  */
 extern int32_t __quadmath_rem_pio2q (__float128, __float128 *);
 extern void __quadmath_kernel_sincosq (__float128, __float128, __float128 *,
diff --git a/libquadmath/quadmath-rounding-mode.h b/libquadmath/quadmath-rounding-mode.h
new file mode 100644
index 0000000..d51058f
--- /dev/null
+++ b/libquadmath/quadmath-rounding-mode.h
@@ -0,0 +1,85 @@
+/* GCC Quad-Precision Math Library
+   Copyright (C) 2012 Free Software Foundation, Inc.
+
+This file is part of the libquadmath library.
+Libquadmath is free software; you can redistribute it and/or
+modify it under the terms of the GNU Library General Public
+License as published by the Free Software Foundation; either
+version 2 of the License, or (at your option) any later version.
+
+Libquadmath is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+Library General Public License for more details.
+
+You should have received a copy of the GNU Library General Public
+License along with libquadmath; see the file COPYING.LIB.  If
+not, write to the Free Software Foundation, Inc., 51 Franklin Street - Fifth Floor,
+Boston, MA 02110-1301, USA.  */
+
+
+#ifndef QUADMATH_ROUNDING_MODE_H
+#define QUADMATH_ROUNDING_MODE_H
+
+#include <stdlib.h>
+#include <stdbool.h>
+
+/* Under IEEE 754, an architecture may determine tininess of
+   floating-point results either "before rounding" or "after
+   rounding", but must do so in the same way for all operations
+   returning binary results.  Define TININESS_AFTER_ROUNDING to 1 for
+   "after rounding" architectures, 0 for "before rounding"
+   architectures.  */
+
+#define TININESS_AFTER_ROUNDING   1
+
+
+/* Rounding mode, cf. GLIBC's rounding-mode.h.  */
+
+#ifdef HAVE_FENV_H
+#  include <fenv.h>
+#  ifdef HAVE_HOST_CPU_IA64
+#    define HAVE_GET_ROUNDING_MODE
+#    include "quadmath-ia64-rounding-mode.h"
+#  elif defined(HAVE_FPU_CONTROL_H) || defined(HAVE_HOST_CPU_X86)
+#    define HAVE_GET_ROUNDING_MODE
+#    include "quadmath-generic-rounding-mode.h"
+#  endif
+#endif /* HAVE_FENV_H */
+
+#ifndef HAVE_GET_ROUNDING_MODE
+static inline int
+get_rounding_mode (void)
+{
+  return FE_TONEAREST;
+}
+#endif
+
+static inline bool
+round_away (bool negative, bool last_digit_odd, bool half_bit, bool more_bits,
+            int mode)
+{
+#ifdef HAVE_GET_ROUNDING_MODE
+  switch (mode)
+    {
+    case FE_DOWNWARD:
+      return negative && (half_bit || more_bits);
+
+    case FE_TONEAREST:
+      return half_bit && (last_digit_odd || more_bits);
+
+    case FE_TOWARDZERO:
+      return false;
+
+    case FE_UPWARD:
+      return !negative && (half_bit || more_bits);
+
+    default:
+      abort ();
+    }
+#else
+  return false;
+#endif
+}
+
+#endif /* QUADMATH_ROUNDING_MODE_H  */
diff --git a/libquadmath/quadmath-x64-fpu_control.h b/libquadmath/quadmath-x64-fpu_control.h
new file mode 100644
index 0000000..69f5544
--- /dev/null
+++ b/libquadmath/quadmath-x64-fpu_control.h
@@ -0,0 +1,109 @@
+/* FPU control word bits.  x86 version.
+   Copyright (C) 1993-2012 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Olaf Flebbe.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <http://www.gnu.org/licenses/>.  */
+
+#ifndef QUADMATH_X64_FPU_CONTROL_H
+#define QUADMATH_X64_FPU_CONTROL_H	1
+
+/* Note that this file sets on x86-64 only the x87 FPU, it does not
+   touch the SSE unit.  */
+
+/* Here is the dirty part. Set up your 387 through the control word
+ * (cw) register.
+ *
+ *     15-13    12  11-10  9-8     7-6     5    4    3    2    1    0
+ * | reserved | IC | RC  | PC | reserved | PM | UM | OM | ZM | DM | IM
+ *
+ * IM: Invalid operation mask
+ * DM: Denormalized operand mask
+ * ZM: Zero-divide mask
+ * OM: Overflow mask
+ * UM: Underflow mask
+ * PM: Precision (inexact result) mask
+ *
+ * Mask bit is 1 means no interrupt.
+ *
+ * PC: Precision control
+ * 11 - round to extended precision
+ * 10 - round to double precision
+ * 00 - round to single precision
+ *
+ * RC: Rounding control
+ * 00 - rounding to nearest
+ * 01 - rounding down (toward - infinity)
+ * 10 - rounding up (toward + infinity)
+ * 11 - rounding toward zero
+ *
+ * IC: Infinity control
+ * That is for 8087 and 80287 only.
+ *
+ * The hardware default is 0x037f which we use.
+ */
+
+#include <features.h>
+
+/* masking of interrupts */
+#define _FPU_MASK_IM  0x01
+#define _FPU_MASK_DM  0x02
+#define _FPU_MASK_ZM  0x04
+#define _FPU_MASK_OM  0x08
+#define _FPU_MASK_UM  0x10
+#define _FPU_MASK_PM  0x20
+
+/* precision control */
+#define _FPU_EXTENDED 0x300	/* libm requires double extended precision.  */
+#define _FPU_DOUBLE   0x200
+#define _FPU_SINGLE   0x0
+
+/* rounding control */
+#define _FPU_RC_NEAREST 0x0    /* RECOMMENDED */
+#define _FPU_RC_DOWN    0x400
+#define _FPU_RC_UP      0x800
+#define _FPU_RC_ZERO    0xC00
+
+#define _FPU_RESERVED 0xF0C0  /* Reserved bits in cw */
+
+
+/* The fdlibm code requires strict IEEE double precision arithmetic,
+   and no interrupts for exceptions, rounding to nearest.  */
+
+#define _FPU_DEFAULT  0x037f
+
+/* IEEE:  same as above.  */
+#define _FPU_IEEE     0x037f
+
+/* Type of the control word.  */
+typedef unsigned int fpu_control_t __attribute__ ((__mode__ (__HI__)));
+
+/* Macros for accessing the hardware control word.  "*&" is used to
+   work around a bug in older versions of GCC.  __volatile__ is used
+   to support combination of writing the control register and reading
+   it back.  Without __volatile__, the old value may be used for reading
+   back under compiler optimization.
+
+   Note that the use of these macros is not sufficient anymore with
+   recent hardware nor on x86-64.  Some floating point operations are
+   executed in the SSE/SSE2 engines which have their own control and
+   status register.  */
+#define _FPU_GETCW(cw) __asm__ __volatile__ ("fnstcw %0" : "=m" (*&cw))
+#define _FPU_SETCW(cw) __asm__ __volatile__ ("fldcw %0" : : "m" (*&cw))
+
+/* Default control word set at startup.  */
+extern fpu_control_t __fpu_control;
+
+#endif	/* fpu_control.h */
diff --git a/libquadmath/strtod/strtod_l.c b/libquadmath/strtod/strtod_l.c
index a3df5e2..ce35656 100644
--- a/libquadmath/strtod/strtod_l.c
+++ b/libquadmath/strtod/strtod_l.c
@@ -1,6 +1,5 @@
 /* Convert string representing a number to float value, using given locale.
-   Copyright (C) 1997,1998,2002,2004,2005,2006,2007,2008,2009,2010
-   Free Software Foundation, Inc.
+   Copyright (C) 1997-2012 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
 
@@ -15,13 +14,14 @@
    Lesser General Public License for more details.
 
    You should have received a copy of the GNU Lesser General Public
-   License along with the GNU C Library; if not, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
+   License along with the GNU C Library; if not, see
+   <http://www.gnu.org/licenses/>.  */
 
 #include <config.h>
 #include <stdarg.h>
 #include <string.h>
+#include <stdint.h>
+#include <stdbool.h>
 #include <float.h>
 #include <math.h>
 #define NDEBUG 1
@@ -29,9 +29,13 @@
 #ifdef HAVE_ERRNO_H
 #include <errno.h>
 #endif
+#include "quadmath-rounding-mode.h"
 #include "../printf/quadmath-printf.h"
 #include "../printf/fpioconst.h"
 
+#ifdef HAVE_FENV_H
+#include <fenv.h>
+#endif
 
 #undef L_
 #ifdef USE_WIDE_CHAR
@@ -89,6 +93,8 @@ __quadmath_strncasecmp_c (const char *s1, const char *s2, size_t n)
 #define	MIN_EXP		PASTE(FLT,_MIN_EXP)
 #define MAX_10_EXP	PASTE(FLT,_MAX_10_EXP)
 #define MIN_10_EXP	PASTE(FLT,_MIN_10_EXP)
+#define MAX_VALUE	PASTE(FLT,_MAX)
+#define MIN_VALUE	PASTE(FLT,_MIN)
 
 /* Extra macros required to get FLT expanded before the pasting.  */
 #define PASTE(a,b)	PASTE1(a,b)
@@ -125,33 +131,62 @@ extern const mp_limb_t _tens_in_limb[MAX_DIG_PER_LIMB + 1] attribute_hidden;
     do { if (endptr != NULL) *endptr = (STRING_TYPE *) (end);		      \
 	 return val; } while (0)
 
-/* Maximum size necessary for mpn integers to hold floating point numbers.  */
-#define	MPNSIZE		(howmany (MAX_EXP + 2 * MANT_DIG, BITS_PER_MP_LIMB) \
-			 + 2)
+/* Maximum size necessary for mpn integers to hold floating point
+   numbers.  The largest number we need to hold is 10^n where 2^-n is
+   1/4 ulp of the smallest representable value (that is, n = MANT_DIG
+   - MIN_EXP + 2).  Approximate using 10^3 < 2^10.  */
+#define	MPNSIZE		(howmany (1 + ((MANT_DIG - MIN_EXP + 2) * 10) / 3, \
+				  BITS_PER_MP_LIMB) + 2)
 /* Declare an mpn integer variable that big.  */
 #define	MPN_VAR(name)	mp_limb_t name[MPNSIZE]; mp_size_t name##size
 /* Copy an mpn integer value.  */
 #define MPN_ASSIGN(dst, src) \
 	memcpy (dst, src, (dst##size = src##size) * sizeof (mp_limb_t))
 
+/* Set errno and return an overflowing value with sign specified by
+   NEGATIVE.  */
+static FLOAT
+overflow_value (int negative)
+{
+#if defined HAVE_ERRNO_H && defined ERANGE
+  errno = ERANGE;
+#endif
+  FLOAT result = (negative ? -MAX_VALUE : MAX_VALUE) * MAX_VALUE;
+  return result;
+}
+
+/* Set errno and return an underflowing value with sign specified by
+   NEGATIVE.  */
+static FLOAT
+underflow_value (int negative)
+{
+#if defined HAVE_ERRNO_H && defined ERANGE
+  errno = ERANGE;
+#endif
+  FLOAT result = (negative ? -MIN_VALUE : MIN_VALUE) * MIN_VALUE;
+  return result;
+}
 
 /* Return a floating point number of the needed type according to the given
    multi-precision number after possible rounding.  */
 static FLOAT
-round_and_return (mp_limb_t *retval, int exponent, int negative,
+round_and_return (mp_limb_t *retval, intmax_t exponent, int negative,
 		  mp_limb_t round_limb, mp_size_t round_bit, int more_bits)
 {
+#ifdef HAVE_FENV_H
+  int mode = get_rounding_mode ();
+#endif
+
   if (exponent < MIN_EXP - 1)
     {
-      mp_size_t shift = MIN_EXP - 1 - exponent;
+      mp_size_t shift;
+      bool is_tiny;
 
-      if (shift > MANT_DIG)
-	{
-#if defined HAVE_ERRNO_H && defined EDOM
-	  errno = EDOM;
-#endif
-	  return 0.0;
-	}
+      if (exponent < MIN_EXP - 1 - MANT_DIG)
+	return underflow_value (negative);
+
+      shift = MIN_EXP - 1 - exponent;
+      is_tiny = true;
 
       more_bits |= (round_limb & ((((mp_limb_t) 1) << round_bit) - 1)) != 0;
       if (shift == MANT_DIG)
@@ -185,6 +220,35 @@ round_and_return (mp_limb_t *retval, int exponent, int negative,
 	}
       else if (shift > 0)
 	{
+#ifdef HAVE_GET_ROUNDING_MODE
+	  if (TININESS_AFTER_ROUNDING && shift == 1)
+	    {
+	      /* Whether the result counts as tiny depends on whether,
+		 after rounding to the normal precision, it still has
+		 a subnormal exponent.  */
+	      mp_limb_t retval_normal[RETURN_LIMB_SIZE];
+	      if (round_away (negative,
+			      (retval[0] & 1) != 0,
+			      (round_limb
+			       & (((mp_limb_t) 1) << round_bit)) != 0,
+			      (more_bits
+			       || ((round_limb
+				    & ((((mp_limb_t) 1) << round_bit) - 1))
+				   != 0)),
+			      mode))
+		{
+		  mp_limb_t cy = mpn_add_1 (retval_normal, retval,
+					      RETURN_LIMB_SIZE, 1);
+
+		  if (((MANT_DIG % BITS_PER_MP_LIMB) == 0 && cy) ||
+		      ((MANT_DIG % BITS_PER_MP_LIMB) != 0 &&
+		       ((retval_normal[RETURN_LIMB_SIZE - 1]
+			& (((mp_limb_t) 1) << (MANT_DIG % BITS_PER_MP_LIMB)))
+			!= 0)))
+		    is_tiny = false;
+		}
+	    }
+#endif
 	  round_limb = retval[0];
 	  round_bit = shift - 1;
 	  (void) mpn_rshift (retval, retval, RETURN_LIMB_SIZE, shift);
@@ -196,14 +260,29 @@ round_and_return (mp_limb_t *retval, int exponent, int negative,
 # define DENORM_EXP (MIN_EXP - 2)
 #endif
       exponent = DENORM_EXP;
+      if (is_tiny
+	  && ((round_limb & (((mp_limb_t) 1) << round_bit)) != 0
+	      || more_bits
+	      || (round_limb & ((((mp_limb_t) 1) << round_bit) - 1)) != 0))
+	{
 #if defined HAVE_ERRNO_H && defined ERANGE
-      errno = ERANGE;
+	  errno = ERANGE;
 #endif
+	  volatile FLOAT force_underflow_exception = MIN_VALUE * MIN_VALUE;
+	  (void) force_underflow_exception;
+	}
     }
 
-  if ((round_limb & (((mp_limb_t) 1) << round_bit)) != 0
-      && (more_bits || (retval[0] & 1) != 0
-	  || (round_limb & ((((mp_limb_t) 1) << round_bit) - 1)) != 0))
+  if (exponent > MAX_EXP)
+    goto overflow;
+
+#ifdef HAVE_GET_ROUNDING_MODE
+  if (round_away (negative,
+		  (retval[0] & 1) != 0,
+		  (round_limb & (((mp_limb_t) 1) << round_bit)) != 0,
+		  (more_bits
+		   || (round_limb & ((((mp_limb_t) 1) << round_bit) - 1)) != 0),
+		  mode))
     {
       mp_limb_t cy = mpn_add_1 (retval, retval, RETURN_LIMB_SIZE, 1);
 
@@ -224,9 +303,11 @@ round_and_return (mp_limb_t *retval, int exponent, int negative,
 	  /* The number was denormalized but now normalized.  */
 	exponent = MIN_EXP - 1;
     }
+#endif
 
   if (exponent > MAX_EXP)
-    return negative ? -FLOAT_HUGE_VAL : FLOAT_HUGE_VAL;
+  overflow:
+    return overflow_value (negative);
 
   return MPN2FLOAT (retval, exponent, negative);
 }
@@ -239,7 +320,7 @@ round_and_return (mp_limb_t *retval, int exponent, int negative,
    factor for the resulting number (see code) multiply by it.  */
 static const STRING_TYPE *
 str_to_mpn (const STRING_TYPE *str, int digcnt, mp_limb_t *n, mp_size_t *nsize,
-	    int *exponent
+	    intmax_t *exponent
 #ifndef USE_WIDE_CHAR
 	    , const char *decimal, size_t decimal_len, const char *thousands
 #endif
@@ -269,6 +350,7 @@ str_to_mpn (const STRING_TYPE *str, int digcnt, mp_limb_t *n, mp_size_t *nsize,
 	      cy += mpn_add_1 (n, n, *nsize, low);
 	      if (cy != 0)
 		{
+		  assert (*nsize < MPNSIZE);
 		  n[*nsize] = cy;
 		  ++(*nsize);
 		}
@@ -303,7 +385,7 @@ str_to_mpn (const STRING_TYPE *str, int digcnt, mp_limb_t *n, mp_size_t *nsize,
     }
   while (--digcnt > 0);
 
-  if (*exponent > 0 && cnt + *exponent <= MAX_DIG_PER_LIMB)
+  if (*exponent > 0 && *exponent <= MAX_DIG_PER_LIMB - cnt)
     {
       low *= _tens_in_limb[*exponent];
       start = _tens_in_limb[cnt + *exponent];
@@ -323,7 +405,10 @@ str_to_mpn (const STRING_TYPE *str, int digcnt, mp_limb_t *n, mp_size_t *nsize,
       cy = mpn_mul_1 (n, n, *nsize, start);
       cy += mpn_add_1 (n, n, *nsize, low);
       if (cy != 0)
-	n[(*nsize)++] = cy;
+	{
+	  assert (*nsize < MPNSIZE);
+	  n[(*nsize)++] = cy;
+	}
     }
 
   return str;
@@ -380,7 +465,7 @@ ____STRTOF_INTERNAL (nptr, endptr, group)
 {
   int negative;			/* The sign of the number.  */
   MPN_VAR (num);		/* MP representation of the number.  */
-  int exponent;			/* Exponent of the number.  */
+  intmax_t exponent;		/* Exponent of the number.  */
 
   /* Numbers starting `0X' or `0x' have to be processed with base 16.  */
   int base = 10;
@@ -402,10 +487,15 @@ ____STRTOF_INTERNAL (nptr, endptr, group)
   /* Points at the character following the integer and fractional digits.  */
   const STRING_TYPE *expp;
   /* Total number of digit and number of digits in integer part.  */
-  int dig_no, int_no, lead_zero;
+  size_t dig_no, int_no, lead_zero;
   /* Contains the last character read.  */
   CHAR_TYPE c;
 
+/* We should get wint_t from <stddef.h>, but not all GCC versions define it
+   there.  So define it ourselves if it remains undefined.  */
+#ifndef _WINT_T
+  typedef unsigned int wint_t;
+#endif
   /* The radix character of the current locale.  */
 #ifdef USE_WIDE_CHAR
   wchar_t decimal;
@@ -758,7 +848,7 @@ ____STRTOF_INTERNAL (nptr, endptr, group)
      are all or any is really a fractional digit will be decided
      later.  */
   int_no = dig_no;
-  lead_zero = int_no == 0 ? -1 : 0;
+  lead_zero = int_no == 0 ? (size_t) -1 : 0;
 
   /* Read the fractional digits.  A special case are the 'american
      style' numbers like `16.' i.e. with decimal point but without
@@ -780,12 +870,13 @@ ____STRTOF_INTERNAL (nptr, endptr, group)
 	     (base == 16 && ({ CHAR_TYPE lo = TOLOWER (c);
 			       lo >= L_('a') && lo <= L_('f'); })))
 	{
-	  if (c != L_('0') && lead_zero == -1)
+	  if (c != L_('0') && lead_zero == (size_t) -1)
 	    lead_zero = dig_no - int_no;
 	  ++dig_no;
 	  c = *++cp;
 	}
     }
+  assert (dig_no <= (uintmax_t) INTMAX_MAX);
 
   /* Remember start of exponent (if any).  */
   expp = cp;
@@ -808,24 +899,80 @@ ____STRTOF_INTERNAL (nptr, endptr, group)
 
       if (c >= L_('0') && c <= L_('9'))
 	{
-	  int exp_limit;
+	  intmax_t exp_limit;
 
 	  /* Get the exponent limit. */
 	  if (base == 16)
-	    exp_limit = (exp_negative ?
-			 -MIN_EXP + MANT_DIG + 4 * int_no :
-			 MAX_EXP - 4 * int_no + 4 * lead_zero + 3);
+	    {
+	      if (exp_negative)
+		{
+		  assert (int_no <= (uintmax_t) (INTMAX_MAX
+						 + MIN_EXP - MANT_DIG) / 4);
+		  exp_limit = -MIN_EXP + MANT_DIG + 4 * (intmax_t) int_no;
+		}
+	      else
+		{
+		  if (int_no)
+		    {
+		      assert (lead_zero == 0
+			      && int_no <= (uintmax_t) INTMAX_MAX / 4);
+		      exp_limit = MAX_EXP - 4 * (intmax_t) int_no + 3;
+		    }
+		  else if (lead_zero == (size_t) -1)
+		    {
+		      /* The number is zero and this limit is
+			 arbitrary.  */
+		      exp_limit = MAX_EXP + 3;
+		    }
+		  else
+		    {
+		      assert (lead_zero
+			      <= (uintmax_t) (INTMAX_MAX - MAX_EXP - 3) / 4);
+		      exp_limit = (MAX_EXP
+				   + 4 * (intmax_t) lead_zero
+				   + 3);
+		    }
+		}
+	    }
 	  else
-	    exp_limit = (exp_negative ?
-			 -MIN_10_EXP + MANT_DIG + int_no :
-			 MAX_10_EXP - int_no + lead_zero + 1);
+	    {
+	      if (exp_negative)
+		{
+		  assert (int_no
+			  <= (uintmax_t) (INTMAX_MAX + MIN_10_EXP - MANT_DIG));
+		  exp_limit = -MIN_10_EXP + MANT_DIG + (intmax_t) int_no;
+		}
+	      else
+		{
+		  if (int_no)
+		    {
+		      assert (lead_zero == 0
+			      && int_no <= (uintmax_t) INTMAX_MAX);
+		      exp_limit = MAX_10_EXP - (intmax_t) int_no + 1;
+		    }
+		  else if (lead_zero == (size_t) -1)
+		    {
+		      /* The number is zero and this limit is
+			 arbitrary.  */
+		      exp_limit = MAX_10_EXP + 1;
+		    }
+		  else
+		    {
+		      assert (lead_zero
+			      <= (uintmax_t) (INTMAX_MAX - MAX_10_EXP - 1));
+		      exp_limit = MAX_10_EXP + (intmax_t) lead_zero + 1;
+		    }
+		}
+	    }
+
+	  if (exp_limit < 0)
+	    exp_limit = 0;
 
 	  do
 	    {
-	      exponent *= 10;
-	      exponent += c - L_('0');
-
-	      if (__builtin_expect (exponent > exp_limit, 0))
+	      if (__builtin_expect ((exponent > exp_limit / 10
+				     || (exponent == exp_limit / 10
+					 && c - L_('0') > exp_limit % 10)), 0))
 		/* The exponent is too large/small to represent a valid
 		   number.  */
 		{
@@ -834,7 +981,7 @@ ____STRTOF_INTERNAL (nptr, endptr, group)
 		  /* We have to take care for special situation: a joker
 		     might have written "0.0e100000" which is in fact
 		     zero.  */
-		  if (lead_zero == -1)
+		  if (lead_zero == (size_t) -1)
 		    result = negative ? -0.0 : 0.0;
 		  else
 		    {
@@ -923,7 +1070,14 @@ ____STRTOF_INTERNAL (nptr, endptr, group)
 	}
 #endif
       startp += lead_zero + decimal_len;
-      exponent -= base == 16 ? 4 * lead_zero : lead_zero;
+      assert (lead_zero <= (base == 16
+			    ? (uintmax_t) INTMAX_MAX / 4
+			    : (uintmax_t) INTMAX_MAX));
+      assert (lead_zero <= (base == 16
+			    ? ((uintmax_t) exponent
+			       - (uintmax_t) INTMAX_MIN) / 4
+			    : ((uintmax_t) exponent - (uintmax_t) INTMAX_MIN)));
+      exponent -= base == 16 ? 4 * (intmax_t) lead_zero : (intmax_t) lead_zero;
       dig_no -= lead_zero;
     }
 
@@ -965,7 +1119,10 @@ ____STRTOF_INTERNAL (nptr, endptr, group)
 	}
 
       /* Adjust the exponent for the bits we are shifting in.  */
-      exponent += bits - 1 + (int_no - 1) * 4;
+      assert (int_no <= (uintmax_t) (exponent < 0
+				     ? (INTMAX_MAX - bits + 1) / 4
+				     : (INTMAX_MAX - exponent - bits + 1) / 4));
+      exponent += bits - 1 + ((intmax_t) int_no - 1) * 4;
 
       while (--dig_no > 0 && idx >= 0)
 	{
@@ -986,8 +1143,20 @@ ____STRTOF_INTERNAL (nptr, endptr, group)
 	      retval[idx--] |= val >> (4 - pos - 1);
 	      val <<= BITS_PER_MP_LIMB - (4 - pos - 1);
 	      if (idx < 0)
-		return round_and_return (retval, exponent, negative, val,
-					 BITS_PER_MP_LIMB - 1, dig_no > 0);
+		{
+		  int rest_nonzero = 0;
+		  while (--dig_no > 0)
+		    {
+		      if (*startp != L_('0'))
+			{
+			  rest_nonzero = 1;
+			  break;
+			}
+		      startp++;
+		    }
+		  return round_and_return (retval, exponent, negative, val,
+					   BITS_PER_MP_LIMB - 1, rest_nonzero);
+		}
 
 	      retval[idx] = val;
 	      pos = BITS_PER_MP_LIMB - 1 - (4 - pos - 1);
@@ -1005,27 +1174,19 @@ ____STRTOF_INTERNAL (nptr, endptr, group)
      really integer digits or belong to the fractional part; i.e. we normalize
      123e-2 to 1.23.  */
   {
-    register int incr = (exponent < 0 ? MAX (-int_no, exponent)
-			 : MIN (dig_no - int_no, exponent));
+    register intmax_t incr = (exponent < 0
+			      ? MAX (-(intmax_t) int_no, exponent)
+			      : MIN ((intmax_t) dig_no - (intmax_t) int_no,
+				     exponent));
     int_no += incr;
     exponent -= incr;
   }
 
-  if (__builtin_expect (int_no + exponent > MAX_10_EXP + 1, 0))
-    {
-#if defined HAVE_ERRNO_H && defined ERANGE
-      errno = ERANGE;
-#endif
-      return negative ? -FLOAT_HUGE_VAL : FLOAT_HUGE_VAL;
-    }
+  if (__builtin_expect (exponent > MAX_10_EXP + 1 - (intmax_t) int_no, 0))
+    return overflow_value (negative);
 
   if (__builtin_expect (exponent < MIN_10_EXP - (DIG + 1), 0))
-    {
-#if defined HAVE_ERRNO_H && defined ERANGE
-      errno = ERANGE;
-#endif
-      return negative ? -0.0 : 0.0;
-    }
+    return underflow_value (negative);
 
   if (int_no > 0)
     {
@@ -1086,12 +1247,7 @@ ____STRTOF_INTERNAL (nptr, endptr, group)
       /* Now we know the exponent of the number in base two.
 	 Check it against the maximum possible exponent.  */
       if (__builtin_expect (bits > MAX_EXP, 0))
-	{
-#if defined HAVE_ERRNO_H && defined ERANGE
-	  errno = ERANGE;
-#endif
-	  return negative ? -FLOAT_HUGE_VAL : FLOAT_HUGE_VAL;
-	}
+	return overflow_value (negative);
 
       /* We have already the first BITS bits of the result.  Together with
 	 the information whether more non-zero bits follow this is enough
@@ -1188,29 +1344,66 @@ ____STRTOF_INTERNAL (nptr, endptr, group)
     int expbit;
     int neg_exp;
     int more_bits;
+    int need_frac_digits;
     mp_limb_t cy;
     mp_limb_t *psrc = den;
     mp_limb_t *pdest = num;
     const struct mp_power *ttab = &_fpioconst_pow10[0];
 
-    assert (dig_no > int_no && exponent <= 0);
+    assert (dig_no > int_no
+	    && exponent <= 0
+	    && exponent >= MIN_10_EXP - (DIG + 1));
+
+    /* We need to compute MANT_DIG - BITS fractional bits that lie
+       within the mantissa of the result, the following bit for
+       rounding, and to know whether any subsequent bit is 0.
+       Computing a bit with value 2^-n means looking at n digits after
+       the decimal point.  */
+    if (bits > 0)
+      {
+	/* The bits required are those immediately after the point.  */
+	assert (int_no > 0 && exponent == 0);
+	need_frac_digits = 1 + MANT_DIG - bits;
+      }
+    else
+      {
+	/* The number is in the form .123eEXPONENT.  */
+	assert (int_no == 0 && *startp != L_('0'));
+	/* The number is at least 10^(EXPONENT-1), and 10^3 <
+	   2^10.  */
+	int neg_exp_2 = ((1 - exponent) * 10) / 3 + 1;
+	/* The number is at least 2^-NEG_EXP_2.  We need up to
+	   MANT_DIG bits following that bit.  */
+	need_frac_digits = neg_exp_2 + MANT_DIG;
+	/* However, we never need bits beyond 1/4 ulp of the smallest
+	   representable value.  (That 1/4 ulp bit is only needed to
+	   determine tinyness on machines where tinyness is determined
+	   after rounding.)  */
+	if (need_frac_digits > MANT_DIG - MIN_EXP + 2)
+	  need_frac_digits = MANT_DIG - MIN_EXP + 2;
+	/* At this point, NEED_FRAC_DIGITS is the total number of
+	   digits needed after the point, but some of those may be
+	   leading 0s.  */
+	need_frac_digits += exponent;
+	/* Any cases underflowing enough that none of the fractional
+	   digits are needed should have been caught earlier (such
+	   cases are on the order of 10^-n or smaller where 2^-n is
+	   the least subnormal).  */
+	assert (need_frac_digits > 0);
+      }
 
+    if (need_frac_digits > (intmax_t) dig_no - (intmax_t) int_no)
+      need_frac_digits = (intmax_t) dig_no - (intmax_t) int_no;
 
-    /* For the fractional part we need not process too many digits.  One
-       decimal digits gives us log_2(10) ~ 3.32 bits.  If we now compute
-			ceil(BITS / 3) =: N
-       digits we should have enough bits for the result.  The remaining
-       decimal digits give us the information that more bits are following.
-       This can be used while rounding.  (Two added as a safety margin.)  */
-    if (dig_no - int_no > (MANT_DIG - bits + 2) / 3 + 2)
+    if ((intmax_t) dig_no > (intmax_t) int_no + need_frac_digits)
       {
-	dig_no = int_no + (MANT_DIG - bits + 2) / 3 + 2;
+	dig_no = int_no + need_frac_digits;
 	more_bits = 1;
       }
     else
       more_bits = 0;
 
-    neg_exp = dig_no - int_no - exponent;
+    neg_exp = (intmax_t) dig_no - (intmax_t) int_no - exponent;
 
     /* Construct the denominator.  */
     densize = 0;
@@ -1510,6 +1703,7 @@ ____STRTOF_INTERNAL (nptr, endptr, group)
 	      assert (numsize == densize);
 	      for (i = numsize; i > 0; --i)
 		num[i] = num[i - 1];
+	      num[0] = 0;
 	    }
 
 	  den[densize] = 0;
@@ -1554,6 +1748,7 @@ ____STRTOF_INTERNAL (nptr, endptr, group)
 	      n0 = num[densize] = num[densize - 1];
 	      for (i = densize - 1; i > 0; --i)
 		num[i] = num[i - 1];
+	      num[0] = 0;
 
 	      got_limb;
 	    }
