This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] Further libquadmath additions (PR fortran/46416)


Hi!

This patch (on top of previous two) adds the remaining entrypoints mentioned
in that PR, except for nexttowardq which doesn't make much sense to me
(nexttoward* second argument is always long double, for one with both
__float128 there is nextafterq and having one toward a less precise type
doesn't seem to be very useful to me).

I've also fixed some minor issues I've discovered (e.g. nothing seems to
define __BIG_ENDIAN__ or __LITTLE_ENDIAN__, so it was IMHO always wrong on
big endian targets).  Ok for trunk?

2011-01-06  Jakub Jelinek  <jakub@redhat.com>

	PR fortran/46416
	* quadmath.h (cbrtq, finiteq, isnanq, signbitq, sqrtq): Remove
	const from prototype argument.
	(cimagq, conjq, cprojq, crealq, fdimq, fmaxq, fminq, ilogbq,
	llrintq, log2q, lrintq, nearbyintq, remquoq): New prototypes.
	(__quadmath_extern_inline): Define.
	(cimagq, conjq, crealq): New inlines.
	* Makefile.am (libquadmath_la_SOURCES): Add math/cimagq.c,
	math/conjq.c, math/cprojq.c, math/crealq.c, math/fdimq.c,
	math/fmaxq.c, math/fminq.c, math/ilogbq.c, math/llrintq.c,
	math/log2q.c, math/lrintq.c, math/nearbyintq.c and math/remquoq.c.
	* Makefile.in: Regenerated.
	* quadmath_weak.h (cimagq, conjq, cprojq, crealq, fdimq, fmaxq,
	fminq, ilogbq, llrintq, log2q, lrintq, nearbyintq, remquoq): Add.
	* quadmath-imp.h (__LITTLE_ENDIAN__): Don't define.
	(ieee854_float128): Use __BYTE_ORDER == __ORDER_BIG_ENDIAN__
	tests instead of __BIG_ENDIAN__.
	* quadmath.map (QUADMATH_1.0): Add cimagq, conjq, cprojq, crealq,
	fdimq, fmaxq, fminq, ilogbq, llrintq, log2q, lrintq, nearbyintq
	and remquoq.
	* libquadmath.texi (cimagq, conjq, cprojq, crealq, fdimq, fmaxq,
	fminq, ilogbq, llrintq, log2q, lrintq, nearbyintq, remquoq): Add.
	* math/cprojq.c: New file.
	* math/ilogbq.c: New file.
	* math/fminq.c: New file.
	* math/llrintq.c: New file.
	* math/log2q.c: New file.
	* math/lrintq.c: New file.
	* math/crealq.c: New file.
	* math/nearbyintq.c: New file.
	* math/fmaxq.c: New file.
	* math/conjq.c: New file.
	* math/remquoq.c: New file.
	* math/cimagq.c: New file.
	* math/fdimq.c: New file.

	* math/ldexpq.c: Include errno.h.  Set errno to ERANGE if needed.

--- libquadmath/quadmath.h.jj	2011-01-06 17:25:22.000000000 +0100
+++ libquadmath/quadmath.h	2011-01-06 19:25:20.000000000 +0100
@@ -36,7 +36,7 @@ extern __float128 asinhq (__float128);
 extern __float128 atanq (__float128);
 extern __float128 atanhq (__float128);
 extern __float128 atan2q (__float128, __float128);
-extern __float128 cbrtq (const __float128);
+extern __float128 cbrtq (__float128);
 extern __float128 ceilq (__float128);
 extern __float128 copysignq (__float128, __float128);
 extern __float128 coshq (__float128);
@@ -46,38 +46,47 @@ extern __float128 erfcq (__float128);
 extern __float128 expq (__float128);
 extern __float128 expm1q (__float128);
 extern __float128 fabsq (__float128);
-extern int finiteq (const __float128);
+extern __float128 fdimq (__float128, __float128);
+extern int finiteq (__float128);
 extern __float128 floorq (__float128);
 extern __float128 fmaq (__float128, __float128, __float128);
+extern __float128 fmaxq (__float128, __float128);
+extern __float128 fminq (__float128, __float128);
 extern __float128 fmodq (__float128, __float128);
 extern __float128 frexpq (__float128, int *);
 extern __float128 hypotq (__float128, __float128);
 extern int isinfq (__float128);
-extern int isnanq (const __float128);
+extern int ilogbq (__float128);
+extern int isnanq (__float128);
 extern __float128 j0q (__float128);
 extern __float128 j1q (__float128);
 extern __float128 jnq (int, __float128);
 extern __float128 ldexpq (__float128, int);
 extern __float128 lgammaq (__float128);
+extern long long int llrintq (__float128);
 extern long long int llroundq (__float128);
 extern __float128 logq (__float128);
 extern __float128 log10q (__float128);
+extern __float128 log2q (__float128);
 extern __float128 log1pq (__float128);
+extern long int lrintq (__float128);
 extern long int lroundq (__float128);
 extern __float128 modfq (__float128, __float128 *);
 extern __float128 nanq (const char *);
+extern __float128 nearbyintq (__float128);
 extern __float128 nextafterq (__float128, __float128);
 extern __float128 powq (__float128, __float128);
 extern __float128 remainderq (__float128, __float128);
+extern __float128 remquoq (__float128, __float128, int *);
 extern __float128 rintq (__float128);
 extern __float128 roundq (__float128);
 extern __float128 scalblnq (__float128, long int);
 extern __float128 scalbnq (__float128, int);
-extern int signbitq (const __float128);
+extern int signbitq (__float128);
 extern void sincosq (__float128, __float128 *, __float128 *);
 extern __float128 sinhq (__float128);
 extern __float128 sinq (__float128);
-extern __float128 sqrtq (const __float128);
+extern __float128 sqrtq (__float128);
 extern __float128 tanq (__float128);
 extern __float128 tanhq (__float128);
 extern __float128 tgammaq (__float128);
@@ -90,6 +99,8 @@ extern __float128 ynq (int, __float128);
 // Prototypes for complex functions
 extern __float128 cabsq (__complex128);
 extern __float128 cargq (__complex128);
+extern __float128 cimagq (__complex128);
+extern __float128 crealq (__complex128);
 extern __complex128 cacosq (__complex128);
 extern __complex128 cacoshq (__complex128);
 extern __complex128 casinq (__complex128);
@@ -102,7 +113,9 @@ extern __complex128 cexpq (__complex128)
 extern __complex128 cexpiq (__float128);
 extern __complex128 clogq (__complex128);
 extern __complex128 clog10q (__complex128);
+extern __complex128 conjq (__complex128);
 extern __complex128 cpowq (__complex128, __complex128);
+extern __complex128 cprojq (__complex128);
 extern __complex128 csinq (__complex128);
 extern __complex128 csinhq (__complex128);
 extern __complex128 csqrtq (__complex128);
@@ -146,4 +159,25 @@ extern void quadmath_dtoaq (char *, size
 #define M_SQRT2q	1.4142135623730950488016887242096981Q  /* sqrt(2) */
 #define M_SQRT1_2q	0.7071067811865475244008443621048490Q  /* 1/sqrt(2) */
 
+#define __quadmath_extern_inline \
+  extern inline __attribute__ ((__gnu_inline__))
+
+__quadmath_extern_inline __float128
+cimagq (__complex128 __z)
+{
+  return __imag__ __z;
+}
+
+__quadmath_extern_inline __float128
+crealq (__complex128 __z)
+{
+  return __real__ __z;
+}
+
+__quadmath_extern_inline __complex128
+conjq (__complex128 __z)
+{
+  return __extension__ ~__z;
+}
+
 #endif
--- libquadmath/Makefile.am.jj	2011-01-06 17:25:22.000000000 +0100
+++ libquadmath/Makefile.am	2011-01-06 19:48:58.000000000 +0100
@@ -63,7 +63,10 @@ libquadmath_la_SOURCES = \
   math/nanq.c math/tgammaq.c math/finiteq.c math/nextafterq.c \
   math/truncq.c math/floorq.c math/powq.c math/fmaq.c \
   math/cacoshq.c math/cacosq.c math/casinhq.c math/casinq.c \
-  math/catanhq.c math/catanq.c
+  math/catanhq.c math/catanq.c math/cimagq.c math/conjq.c math/cprojq.c \
+  math/crealq.c math/fdimq.c math/fmaxq.c math/fminq.c math/ilogbq.c \
+  math/llrintq.c math/log2q.c math/lrintq.c math/nearbyintq.c math/remquoq.c
+
 
 # Work around what appears to be a GNU make bug handling MAKEFLAGS
 # values defined in terms of make variables, as is the case for CC and
--- libquadmath/quadmath_weak.h.jj	2011-01-06 17:25:22.000000000 +0100
+++ libquadmath/quadmath_weak.h	2011-01-06 19:34:57.000000000 +0100
@@ -53,12 +53,16 @@ __qmath3 (erfcq)
 __qmath3 (expq)
 __qmath3 (expm1q)
 __qmath3 (fabsq)
+__qmath3 (fdimq)
 __qmath3 (finiteq)
 __qmath3 (floorq)
 __qmath3 (fmaq)
+__qmath3 (fmaxq)
+__qmath3 (fminq)
 __qmath3 (fmodq)
 __qmath3 (frexpq)
 __qmath3 (hypotq)
+__qmath3 (ilogbq)
 __qmath3 (isinfq)
 __qmath3 (isnanq)
 __qmath3 (j0q)
@@ -66,16 +70,21 @@ __qmath3 (j1q)
 __qmath3 (jnq)
 __qmath3 (ldexpq)
 __qmath3 (lgammaq)
+__qmath3 (llrintq)
 __qmath3 (llroundq)
 __qmath3 (logq)
 __qmath3 (log10q)
 __qmath3 (log1pq)
+__qmath3 (log2q)
+__qmath3 (lrintq)
 __qmath3 (lroundq)
 __qmath3 (modfq)
 __qmath3 (nanq)
+__qmath3 (nearbyintq)
 __qmath3 (nextafterq)
 __qmath3 (powq)
 __qmath3 (remainderq)
+__qmath3 (remquoq)
 __qmath3 (rintq)
 __qmath3 (roundq)
 __qmath3 (scalblnq)
@@ -97,6 +106,8 @@ __qmath3 (ynq)
 // Prototypes for complex functions
 __qmath3 (cabsq)
 __qmath3 (cargq)
+__qmath3 (cimagq)
+__qmath3 (crealq)
 __qmath3 (cacosq)
 __qmath3 (cacoshq)
 __qmath3 (casinq)
@@ -109,7 +120,9 @@ __qmath3 (cexpq)
 __qmath3 (cexpiq)
 __qmath3 (clogq)
 __qmath3 (clog10q)
+__qmath3 (conjq)
 __qmath3 (cpowq)
+__qmath3 (cprojq)
 __qmath3 (csinq)
 __qmath3 (csinhq)
 __qmath3 (csqrtq)
--- libquadmath/quadmath-imp.h.jj	2011-01-06 17:25:22.000000000 +0100
+++ libquadmath/quadmath-imp.h	2011-01-06 19:18:39.000000000 +0100
@@ -42,12 +42,6 @@ extern __float128 __quadmath_kernel_cosq
 #endif
 
 
-// If we don't have macros to know endianess, assume little endian
-#if !defined(__BIG_ENDIAN__) && !defined(__LITTLE_ENDIAN__)
-# define __LITTLE_ENDIAN__ 1
-#endif
-
-
 // Main union type we use to manipulate the floating-point type
 typedef union
 {
@@ -55,13 +49,12 @@ typedef union
 
   struct
   {
-#if __BIG_ENDIAN__
+#if __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__
     unsigned negative:1;
     unsigned exponent:15;
     uint64_t mant_high:48;
     uint64_t mant_low:64;
-#endif
-#if __LITTLE_ENDIAN__
+#else
     uint64_t mant_low:64;
     uint64_t mant_high:48;
     unsigned exponent:15;
@@ -71,11 +64,10 @@ typedef union
 
   struct
   {
-#if __BIG_ENDIAN__
+#if __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__
     uint64_t high;
     uint64_t low;
-#endif
-#if __LITTLE_ENDIAN__
+#else
     uint64_t low;
     uint64_t high;
 #endif
@@ -83,13 +75,12 @@ typedef union
 
   struct
   {
-#if __BIG_ENDIAN__
+#if __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__
     uint32_t w0;
     uint32_t w1;
     uint32_t w2;
     uint32_t w3;
-#endif
-#if __LITTLE_ENDIAN__
+#else
     uint32_t w3;
     uint32_t w2;
     uint32_t w1;
@@ -99,14 +90,13 @@ typedef union
 
   struct
   {
-#if __BIG_ENDIAN__
+#if __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__
     unsigned negative:1;
     unsigned exponent:15;
     unsigned quiet_nan:1;
     uint64_t mant_high:47;
     uint64_t mant_low:64;
-#endif
-#if __LITTLE_ENDIAN__
+#else
     uint64_t mant_low:64;
     uint64_t mant_high:47;
     unsigned quiet_nan:1;
--- libquadmath/quadmath.map.jj	2011-01-06 17:25:22.000000000 +0100
+++ libquadmath/quadmath.map	2011-01-06 20:07:14.000000000 +0100
@@ -7,12 +7,6 @@ QUADMATH_1.0 {
     atanq;
     atanhq;
     atan2q;
-    cacoshq;
-    cacosq;
-    casinhq;
-    casinq;
-    catanhq;
-    catanq;
     cbrtq;
     ceilq;
     copysignq;
@@ -23,12 +17,16 @@ QUADMATH_1.0 {
     expq;
     expm1q;
     fabsq;
+    fdimq;
     finiteq;
     floorq;
     fmaq;
+    fmaxq;
+    fminq;
     fmodq;
     frexpq;
     hypotq;
+    ilogbq;
     isinfq;
     isnanq;
     j0q;
@@ -36,16 +34,21 @@ QUADMATH_1.0 {
     jnq;
     ldexpq;
     lgammaq;
+    llrintq;
     llroundq;
     logq;
     log10q;
     log1pq;
+    log2q;
+    lrintq;
     lroundq;
     modfq;
     nanq;
+    nearbyintq;
     nextafterq;
     powq;
     remainderq;
+    remquoq;
     rintq;
     roundq;
     scalblnq;
@@ -64,13 +67,23 @@ QUADMATH_1.0 {
     ynq;
     cabsq;
     cargq;
+    cimagq;
+    crealq;
+    cacoshq;
+    cacosq;
+    casinhq;
+    casinq;
+    catanhq;
+    catanq;
     ccosq;
     ccoshq;
     cexpq;
     cexpiq;
     clogq;
     clog10q;
+    conjq;
     cpowq;
+    cprojq;
     csinq;
     csinhq;
     csqrtq;
--- libquadmath/libquadmath.texi.jj	2011-01-06 17:25:22.000000000 +0100
+++ libquadmath/libquadmath.texi	2011-01-06 19:46:40.000000000 +0100
@@ -111,12 +111,16 @@ The following mathematical functions are
 @item @code{expm1q}: exponential minus 1 function
 @need 800
 @item @code{fabsq}: absolute value function
+@item @code{fdimq}: positive difference function
 @item @code{finiteq}: check finiteness of value
 @item @code{floorq}: floor value function
 @item @code{fmaq}: fused multiply and add
+@item @code{fmaxq}: determine maximum of two values
+@item @code{fminq}: determine minimum of two values
 @item @code{fmodq}: remainder value function
 @item @code{frexpq}: extract mantissa and exponent
 @item @code{hypotq}: Eucledian distance function
+@item @code{ilogbq}: get exponent of the value
 @item @code{isinfq}: check for infinity
 @item @code{isnanq}: check for not a number
 @item @code{j0q}: Bessel function of the first kind, first order
@@ -124,17 +128,22 @@ The following mathematical functions are
 @item @code{jnq}: Bessel function of the first kind, @var{n}-th order
 @item @code{ldexpq}: load exponent of the value
 @item @code{lgammaq}: logarithmic gamma function
+@item @code{llrintq}: round to nearest integer value
 @item @code{llroundq}: round to nearest integer value away from zero
 @item @code{logq}: natural logarithm function
 @item @code{log10q}: base 10 logarithm function
 @item @code{log1pq}: compute natural logarithm of the value plus one
+@item @code{log2q}: base 2 logarithm function
 @need 800
+@item @code{lrintq}: round to nearest integer value
 @item @code{lroundq}: round to nearest integer value away from zero
 @item @code{modfq}: decompose the floating-point number
 @item @code{nanq}: return quiet NaN
+@item @code{nearbyintq}: round to nearest integer
 @item @code{nextafterq}: next representable floating-point number
 @item @code{powq}: power function
 @item @code{remainderq}: remainder function
+@item @code{remquoq}: remainder and part of quotient
 @item @code{rintq}: round-to-nearest integral value
 @item @code{roundq}: round-to-nearest integral value, return @code{__float128}
 @item @code{scalblnq}: compute exponent using @code{FLT_RADIX}
@@ -152,8 +161,10 @@ The following mathematical functions are
 @item @code{y0q}: Bessel function of the second kind, first order
 @item @code{y1q}: Bessel function of the second kind, second order
 @item @code{ynq}: Bessel function of the second kind, @var{n}-th order
-@item @code{cabsq} complex absolute value function:
+@item @code{cabsq} complex absolute value function
 @item @code{cargq}: calculate the argument
+@item @code{cimagq} imaginary part of complex number
+@item @code{crealq}: real part of complex number
 @item @code{cacoshq}: complex arc hyperbolic cosine function
 @item @code{cacosq}: complex arc cosine function
 @item @code{casinhq}: complex arc hyperbolic sine function
@@ -168,7 +179,9 @@ The following mathematical functions are
                      real value
 @item @code{clogq}: complex natural logarithm
 @item @code{clog10q}: complex base 10 logarithm
+@item @code{conjq}: complex conjugate function
 @item @code{cpowq}: complex power function
+@item @code{cprojq}: project into Riemann Sphere
 @item @code{csinq}: complex sine function
 @item @code{csinhq}: complex hyperbolic sine function
 @item @code{csqrtq}: complex square root
--- libquadmath/math/cprojq.c.jj	2011-01-06 17:25:32.000000000 +0100
+++ libquadmath/math/cprojq.c	2011-01-06 17:25:32.000000000 +0100
@@ -0,0 +1,40 @@
+/* Compute projection of complex __float128 value to Riemann sphere.
+   Copyright (C) 1997, 1999, 2010 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
+
+   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, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include "quadmath-imp.h"
+
+
+__complex128
+cprojq (__complex128 x)
+{
+  if (isnanq (__real__ x) && isnanq (__imag__ x))
+    return x;
+  else if (!finiteq (__real__ x) || !finiteq (__imag__ x))
+    {
+      __complex128 res;
+
+      __real__ res = __builtin_inf ();
+      __imag__ res = copysignq (0.0, __imag__ x);
+
+      return res;
+    }
+
+  return x;
+}
--- libquadmath/math/ilogbq.c.jj	2011-01-06 17:43:43.000000000 +0100
+++ libquadmath/math/ilogbq.c	2011-01-06 17:52:56.000000000 +0100
@@ -0,0 +1,64 @@
+/* s_ilogbl.c -- long double version of s_ilogb.c.
+ * Conversion to IEEE quad long double by Jakub Jelinek, jj@ultra.linux.cz.
+ */
+
+/*
+ * ====================================================
+ * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
+ *
+ * Developed at SunPro, a Sun Microsystems, Inc. business.
+ * Permission to use, copy, modify, and distribute this
+ * software is freely granted, provided that this notice
+ * is preserved.
+ * ====================================================
+ */
+
+#if defined(LIBM_SCCS) && !defined(lint)
+static char rcsid[] = "$NetBSD: $";
+#endif
+
+/* ilogbl(long double x)
+ * return the binary exponent of non-zero x
+ * ilogbl(0) = FP_ILOGB0
+ * ilogbl(NaN) = FP_ILOGBNAN (no signal is raised)
+ * ilogbl(+-Inf) = INT_MAX (no signal is raised)
+ */
+
+#include <limits.h>
+#include <math.h>
+#include "quadmath-imp.h"
+
+#ifndef FP_ILOGB0
+# define FP_ILOGB0 INT_MIN
+#endif
+#ifndef FP_ILOGBNAN
+# define FP_ILOGBNAN INT_MAX
+#endif
+
+int
+ilogbq (__float128 x)
+{
+	int64_t hx,lx;
+	int ix;
+
+	GET_FLT128_WORDS64(hx,lx,x);
+	hx &= 0x7fffffffffffffffLL;
+	if(hx <= 0x0001000000000000LL) {
+	    if((hx|lx)==0)
+		return FP_ILOGB0;	/* ilogbl(0) = FP_ILOGB0 */
+	    else			/* subnormal x */
+		if(hx==0) {
+		    for (ix = -16431; lx>0; lx<<=1) ix -=1;
+		} else {
+		    for (ix = -16382, hx<<=15; hx>0; hx<<=1) ix -=1;
+		}
+	    return ix;
+	}
+	else if (hx<0x7fff000000000000LL) return (hx>>48)-0x3fff;
+	else if (FP_ILOGBNAN != INT_MAX) {
+	    /* ISO C99 requires ilogbl(+-Inf) == INT_MAX.  */
+	    if (((hx^0x7fff000000000000LL)|lx) == 0)
+		return INT_MAX;
+	}
+	return FP_ILOGBNAN;
+}
--- libquadmath/math/fminq.c.jj	2011-01-06 17:25:32.000000000 +0100
+++ libquadmath/math/fminq.c	2011-01-06 17:25:32.000000000 +0100
@@ -0,0 +1,28 @@
+/* Return minimum numeric value of X and Y.
+   Copyright (C) 1997 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
+
+   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, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include "quadmath-imp.h"
+
+
+__float128
+fminq (__float128 x, __float128 y)
+{
+  return (__builtin_islessequal (x, y) || isnanq (y)) ? x : y;
+}
--- libquadmath/math/ldexpq.c.jj	2010-11-19 20:56:37.000000000 +0100
+++ libquadmath/math/ldexpq.c	2011-01-06 17:31:21.000000000 +0100
@@ -14,6 +14,7 @@
  * ====================================================
  */
 
+#include <errno.h>
 #include "quadmath-imp.h"
 
 __float128
@@ -21,6 +22,6 @@ ldexpq (__float128 value, int exp)
 {
   if(!finiteq(value)||value==0.0Q) return value;
   value = scalbnq(value,exp);
-  /* if(!__finitel(value)||value==0.0Q) __set_errno (ERANGE); */
+  if(!finiteq(value)||value==0.0Q) errno = ERANGE;
   return value;
 }
--- libquadmath/math/llrintq.c.jj	2011-01-06 17:54:04.000000000 +0100
+++ libquadmath/math/llrintq.c	2011-01-06 18:26:04.000000000 +0100
@@ -0,0 +1,71 @@
+/* Round argument to nearest integral value according to current rounding
+   direction.
+   Copyright (C) 1997, 1999, 2006 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997 and
+   		  Jakub Jelinek <jj@ultra.linux.cz>, 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, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include "quadmath-imp.h"
+
+static const __float128 two112[2] =
+{
+  5.19229685853482762853049632922009600E+33Q, /* 0x406F000000000000, 0 */
+ -5.19229685853482762853049632922009600E+33Q  /* 0xC06F000000000000, 0 */
+};
+
+long long int
+llrintq (__float128 x)
+{
+  int32_t j0;
+  uint64_t i0,i1;
+  volatile __float128 w;
+  __float128 t;
+  long long int result;
+  int sx;
+
+  GET_FLT128_WORDS64 (i0, i1, x);
+  j0 = ((i0 >> 48) & 0x7fff) - 0x3fff;
+  sx = i0 >> 63;
+  i0 &= 0x0000ffffffffffffLL;
+  i0 |= 0x0001000000000000LL;
+
+  if (j0 < (int32_t) (8 * sizeof (long long int)) - 1)
+    {
+      w = two112[sx] + x;
+      t = w - two112[sx];
+      GET_FLT128_WORDS64 (i0, i1, t);
+      j0 = ((i0 >> 48) & 0x7fff) - 0x3fff;
+      i0 &= 0x0000ffffffffffffLL;
+      i0 |= 0x0001000000000000LL;
+
+      if (j0 < 0)
+	result = 0;
+      else if (j0 <= 48)
+	result = i0 >> (48 - j0);
+      else
+	result = ((long long int) i0 << (j0 - 48)) | (i1 >> (112 - j0));
+    }
+  else
+    {
+      /* The number is too large.  It is left implementation defined
+	 what happens.  */
+      return (long long int) x;
+    }
+
+  return sx ? -result : result;
+}
--- libquadmath/math/log2q.c.jj	2011-01-06 18:17:28.000000000 +0100
+++ libquadmath/math/log2q.c	2011-01-06 19:48:11.000000000 +0100
@@ -0,0 +1,248 @@
+/*                                                      log2l.c
+ *      Base 2 logarithm, 128-bit long double precision
+ *
+ *
+ *
+ * SYNOPSIS:
+ *
+ * long double x, y, log2l();
+ *
+ * y = log2l( x );
+ *
+ *
+ *
+ * DESCRIPTION:
+ *
+ * Returns the base 2 logarithm of x.
+ *
+ * The argument is separated into its exponent and fractional
+ * parts.  If the exponent is between -1 and +1, the (natural)
+ * logarithm of the fraction is approximated by
+ *
+ *     log(1+x) = x - 0.5 x^2 + x^3 P(x)/Q(x).
+ *
+ * Otherwise, setting  z = 2(x-1)/x+1),
+ *
+ *     log(x) = z + z^3 P(z)/Q(z).
+ *
+ *
+ *
+ * ACCURACY:
+ *
+ *                      Relative error:
+ * arithmetic   domain     # trials      peak         rms
+ *    IEEE      0.5, 2.0     100,000    2.6e-34     4.9e-35
+ *    IEEE     exp(+-10000)  100,000    9.6e-35     4.0e-35
+ *
+ * In the tests over the interval exp(+-10000), the logarithms
+ * of the random arguments were uniformly distributed over
+ * [-10000, +10000].
+ *
+ */
+
+/*
+   Cephes Math Library Release 2.2:  January, 1991
+   Copyright 1984, 1991 by Stephen L. Moshier
+   Adapted for glibc November, 2001
+
+    This 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.
+
+    This 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 this library; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307  USA 
+ */
+
+#include "quadmath-imp.h"
+
+/* Coefficients for ln(1+x) = x - x**2/2 + x**3 P(x)/Q(x)
+ * 1/sqrt(2) <= x < sqrt(2)
+ * Theoretical peak relative error = 5.3e-37,
+ * relative peak error spread = 2.3e-14
+ */
+static const __float128 P[13] =
+{
+  1.313572404063446165910279910527789794488E4Q,
+  7.771154681358524243729929227226708890930E4Q,
+  2.014652742082537582487669938141683759923E5Q,
+  3.007007295140399532324943111654767187848E5Q,
+  2.854829159639697837788887080758954924001E5Q,
+  1.797628303815655343403735250238293741397E5Q,
+  7.594356839258970405033155585486712125861E4Q,
+  2.128857716871515081352991964243375186031E4Q,
+  3.824952356185897735160588078446136783779E3Q,
+  4.114517881637811823002128927449878962058E2Q,
+  2.321125933898420063925789532045674660756E1Q,
+  4.998469661968096229986658302195402690910E-1Q,
+  1.538612243596254322971797716843006400388E-6Q
+};
+static const __float128 Q[12] =
+{
+  3.940717212190338497730839731583397586124E4Q,
+  2.626900195321832660448791748036714883242E5Q,
+  7.777690340007566932935753241556479363645E5Q,
+  1.347518538384329112529391120390701166528E6Q,
+  1.514882452993549494932585972882995548426E6Q,
+  1.158019977462989115839826904108208787040E6Q,
+  6.132189329546557743179177159925690841200E5Q,
+  2.248234257620569139969141618556349415120E5Q,
+  5.605842085972455027590989944010492125825E4Q,
+  9.147150349299596453976674231612674085381E3Q,
+  9.104928120962988414618126155557301584078E2Q,
+  4.839208193348159620282142911143429644326E1Q
+/* 1.000000000000000000000000000000000000000E0Q, */
+};
+
+/* Coefficients for log(x) = z + z^3 P(z^2)/Q(z^2),
+ * where z = 2(x-1)/(x+1)
+ * 1/sqrt(2) <= x < sqrt(2)
+ * Theoretical peak relative error = 1.1e-35,
+ * relative peak error spread 1.1e-9
+ */
+static const __float128 R[6] =
+{
+  1.418134209872192732479751274970992665513E5Q,
+ -8.977257995689735303686582344659576526998E4Q,
+  2.048819892795278657810231591630928516206E4Q,
+ -2.024301798136027039250415126250455056397E3Q,
+  8.057002716646055371965756206836056074715E1Q,
+ -8.828896441624934385266096344596648080902E-1Q
+};
+static const __float128 S[6] =
+{
+  1.701761051846631278975701529965589676574E6Q,
+ -1.332535117259762928288745111081235577029E6Q,
+  4.001557694070773974936904547424676279307E5Q,
+ -5.748542087379434595104154610899551484314E4Q,
+  3.998526750980007367835804959888064681098E3Q,
+ -1.186359407982897997337150403816839480438E2Q
+/* 1.000000000000000000000000000000000000000E0Q, */
+};
+
+static const __float128
+/* log2(e) - 1 */
+LOG2EA = 4.4269504088896340735992468100189213742664595E-1Q,
+/* sqrt(2)/2 */
+SQRTH = 7.071067811865475244008443621048490392848359E-1Q;
+
+
+/* Evaluate P[n] x^n  +  P[n-1] x^(n-1)  +  ...  +  P[0] */
+
+static __float128
+neval (__float128 x, const __float128 *p, int n)
+{
+  __float128 y;
+
+  p += n;
+  y = *p--;
+  do
+    {
+      y = y * x + *p--;
+    }
+  while (--n > 0);
+  return y;
+}
+
+
+/* Evaluate x^n+1  +  P[n] x^(n)  +  P[n-1] x^(n-1)  +  ...  +  P[0] */
+
+static __float128
+deval (__float128 x, const __float128 *p, int n)
+{
+  __float128 y;
+
+  p += n;
+  y = x + *p--;
+  do
+    {
+      y = y * x + *p--;
+    }
+  while (--n > 0);
+  return y;
+}
+
+
+
+__float128
+log2q (__float128 x)
+{
+  __float128 z;
+  __float128 y;
+  int e;
+  int64_t hx, lx;
+
+/* Test for domain */
+  GET_FLT128_WORDS64 (hx, lx, x);
+  if (((hx & 0x7fffffffffffffffLL) | lx) == 0)
+    return (-1.0Q / (x - x));
+  if (hx < 0)
+    return (x - x) / (x - x);
+  if (hx >= 0x7fff000000000000LL)
+    return (x + x);
+
+/* separate mantissa from exponent */
+
+/* Note, frexp is used so that denormal numbers
+ * will be handled properly.
+ */
+  x = frexpq (x, &e);
+
+
+/* logarithm using log(x) = z + z**3 P(z)/Q(z),
+ * where z = 2(x-1)/x+1)
+ */
+  if ((e > 2) || (e < -2))
+    {
+      if (x < SQRTH)
+	{			/* 2( 2x-1 )/( 2x+1 ) */
+	  e -= 1;
+	  z = x - 0.5Q;
+	  y = 0.5Q * z + 0.5Q;
+	}
+      else
+	{			/*  2 (x-1)/(x+1)   */
+	  z = x - 0.5Q;
+	  z -= 0.5Q;
+	  y = 0.5Q * x + 0.5Q;
+	}
+      x = z / y;
+      z = x * x;
+      y = x * (z * neval (z, R, 5) / deval (z, S, 5));
+      goto done;
+    }
+
+
+/* logarithm using log(1+x) = x - .5x**2 + x**3 P(x)/Q(x) */
+
+  if (x < SQRTH)
+    {
+      e -= 1;
+      x = 2.0 * x - 1.0Q;	/*  2x - 1  */
+    }
+  else
+    {
+      x = x - 1.0Q;
+    }
+  z = x * x;
+  y = x * (z * neval (x, P, 12) / deval (x, Q, 11));
+  y = y - 0.5 * z;
+
+done:
+
+/* Multiply log of fraction by log2(e)
+ * and base 2 exponent by 1
+ */
+  z = y * LOG2EA;
+  z += x * LOG2EA;
+  z += y;
+  z += x;
+  z += e;
+  return (z);
+}
--- libquadmath/math/lrintq.c.jj	2011-01-06 17:54:25.000000000 +0100
+++ libquadmath/math/lrintq.c	2011-01-06 18:26:12.000000000 +0100
@@ -0,0 +1,85 @@
+/* Round argument to nearest integral value according to current rounding
+   direction.
+   Copyright (C) 1997, 1999, 2004, 2006 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997 and
+   		  Jakub Jelinek <jj@ultra.linux.cz>, 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, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include "quadmath-imp.h"
+
+static const __float128 two112[2] =
+{
+  5.19229685853482762853049632922009600E+33Q, /* 0x406F000000000000, 0 */
+ -5.19229685853482762853049632922009600E+33Q  /* 0xC06F000000000000, 0 */
+};
+
+long int
+lrintq (__float128 x)
+{
+  int32_t j0;
+  uint64_t i0,i1;
+  volatile __float128 w;
+  __float128 t;
+  long int result;
+  int sx;
+
+  GET_FLT128_WORDS64 (i0, i1, x);
+  j0 = ((i0 >> 48) & 0x7fff) - 0x3fff;
+  sx = i0 >> 63;
+  i0 &= 0x0000ffffffffffffLL;
+  i0 |= 0x0001000000000000LL;
+
+  if (j0 < 48)
+    {
+      w = two112[sx] + x;
+      t = w - two112[sx];
+      GET_FLT128_WORDS64 (i0, i1, t);
+      j0 = ((i0 >> 48) & 0x7fff) - 0x3fff;
+      i0 &= 0x0000ffffffffffffLL;
+      i0 |= 0x0001000000000000LL;
+
+      result = (j0 < 0 ? 0 : i0 >> (48 - j0));
+    }
+  else if (j0 < (int32_t) (8 * sizeof (long int)) - 1)
+    {
+      if (j0 >= 112)
+	result = ((long int) i0 << (j0 - 48)) | (i1 << (j0 - 112));
+      else
+	{
+	  w = two112[sx] + x;
+	  t = w - two112[sx];
+	  GET_FLT128_WORDS64 (i0, i1, t);
+	  j0 = ((i0 >> 48) & 0x7fff) - 0x3fff;
+	  i0 &= 0x0000ffffffffffffLL;
+	  i0 |= 0x0001000000000000LL;
+
+	  if (j0 == 48)
+	    result = (long int) i0;
+	  else
+	    result = ((long int) i0 << (j0 - 48)) | (i1 >> (112 - j0));
+	}
+    }
+  else
+    {
+      /* The number is too large.  It is left implementation defined
+	 what happens.  */
+      return (long int) x;
+    }
+
+  return sx ? -result : result;
+}
--- libquadmath/math/crealq.c.jj	2011-01-06 17:25:32.000000000 +0100
+++ libquadmath/math/crealq.c	2011-01-06 17:25:32.000000000 +0100
@@ -0,0 +1,27 @@
+/* Return real part of complex __float128 value.
+   Copyright (C) 1997, 1998 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
+
+   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, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include "quadmath-imp.h"
+
+__float128
+crealq (__complex128 z)
+{
+  return __real__ z;
+}
--- libquadmath/math/nearbyintq.c.jj	2011-01-06 18:21:30.000000000 +0100
+++ libquadmath/math/nearbyintq.c	2011-01-06 18:26:23.000000000 +0100
@@ -0,0 +1,98 @@
+/* nearbyintq.c -- __float128 version of s_nearbyint.c.
+ * Conversion to IEEE quad long double by Jakub Jelinek, jj@ultra.linux.cz.
+ */
+
+/*
+ * ====================================================
+ * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
+ *
+ * Developed at SunPro, a Sun Microsystems, Inc. business.
+ * Permission to use, copy, modify, and distribute this
+ * software is freely granted, provided that this notice
+ * is preserved.
+ * ====================================================
+ */
+
+/*
+ * nearbyintq(x)
+ * Return x rounded to integral value according to the prevailing
+ * rounding mode.
+ * Method:
+ *	Using floating addition.
+ * Exception:
+ *	Inexact flag raised if x not equal to rintq(x).
+ */
+
+#include "quadmath-imp.h"
+#ifdef HAVE_FENV_H
+# include <fenv.h>
+# if defined HAVE_FEHOLDEXCEPT && defined HAVE_FESETENV
+#   define USE_FENV_H
+# endif
+#endif
+
+static const __float128
+TWO112[2]={
+  5.19229685853482762853049632922009600E+33Q, /* 0x406F000000000000, 0 */
+ -5.19229685853482762853049632922009600E+33Q  /* 0xC06F000000000000, 0 */
+};
+
+__float128
+nearbyintq(__float128 x)
+{
+#ifdef USE_FENV_H
+	fenv_t env;
+#endif
+	int64_t i0,j0,sx;
+	uint64_t i,i1;
+	__float128 w,t;
+	GET_FLT128_WORDS64(i0,i1,x);
+	sx = (((uint64_t)i0)>>63);
+	j0 = ((i0>>48)&0x7fff)-0x3fff;
+	if(j0<48) {
+	    if(j0<0) {
+		if(((i0&0x7fffffffffffffffLL)|i1)==0) return x;
+		i1 |= (i0&0x0000ffffffffffffLL);
+		i0 &= 0xffffe00000000000ULL;
+		i0 |= ((i1|-i1)>>16)&0x0000800000000000LL;
+		SET_FLT128_MSW64(x,i0);
+#ifdef USE_FENV_H
+		feholdexcept (&env);
+#endif
+	        w = TWO112[sx]+x;
+	        t = w-TWO112[sx];
+#ifdef USE_FENV_H
+	        fesetenv (&env);
+#endif
+		GET_FLT128_MSW64(i0,t);
+		SET_FLT128_MSW64(t,(i0&0x7fffffffffffffffLL)|(sx<<63));
+	        return t;
+	    } else {
+		i = (0x0000ffffffffffffLL)>>j0;
+		if(((i0&i)|i1)==0) return x; /* x is integral */
+		i>>=1;
+		if(((i0&i)|i1)!=0) {
+		    if(j0==47) i1 = 0x4000000000000000ULL; else
+		    i0 = (i0&(~i))|((0x0000200000000000LL)>>j0);
+		}
+	    }
+	} else if (j0>111) {
+	    if(j0==0x4000) return x+x;	/* inf or NaN */
+	    else return x;		/* x is integral */
+	} else {
+	    i = -1ULL>>(j0-48);
+	    if((i1&i)==0) return x;	/* x is integral */
+	    i>>=1;
+	    if((i1&i)!=0) i1 = (i1&(~i))|((0x4000000000000000LL)>>(j0-48));
+	}
+	SET_FLT128_WORDS64(x,i0,i1);
+#ifdef USE_FENV_H
+	feholdexcept (&env);
+#endif
+	w = TWO112[sx]+x;
+	t = w-TWO112[sx];
+#ifdef USE_FENV_H	
+	fesetenv (&env);
+#endif
+	return t;
+}
--- libquadmath/math/fmaxq.c.jj	2011-01-06 17:25:32.000000000 +0100
+++ libquadmath/math/fmaxq.c	2011-01-06 17:25:32.000000000 +0100
@@ -0,0 +1,28 @@
+/* Return maximum numeric value of X and Y.
+   Copyright (C) 1997 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
+
+   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, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include "quadmath-imp.h"
+
+
+__float128
+fmaxq (__float128 x, __float128 y)
+{
+  return (__builtin_isgreaterequal (x, y) || isnanq (y)) ? x : y;
+}
--- libquadmath/math/conjq.c.jj	2011-01-06 17:25:32.000000000 +0100
+++ libquadmath/math/conjq.c	2011-01-06 17:25:32.000000000 +0100
@@ -0,0 +1,27 @@
+/* Return complex conjugate of complex __float128 value.
+   Copyright (C) 1997, 1998 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
+
+   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, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include "quadmath-imp.h"
+
+__complex128
+conjq (__complex128 z)
+{
+  return ~z;
+}
--- libquadmath/math/remquoq.c.jj	2011-01-06 18:27:50.000000000 +0100
+++ libquadmath/math/remquoq.c	2011-01-06 18:29:29.000000000 +0100
@@ -0,0 +1,107 @@
+/* Compute remainder and a congruent to the quotient.
+   Copyright (C) 1997, 1999, 2002 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997 and
+		  Jakub Jelinek <jj@ultra.linux.cz>, 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, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include "quadmath-imp.h"
+
+
+static const __float128 zero = 0.0;
+
+
+__float128
+remquoq (__float128 x, __float128 y, int *quo)
+{
+  int64_t hx,hy;
+  u_int64_t sx,lx,ly,qs;
+  int cquo;
+
+  GET_FLT128_WORDS64 (hx, lx, x);
+  GET_FLT128_WORDS64 (hy, ly, y);
+  sx = hx & 0x8000000000000000ULL;
+  qs = sx ^ (hy & 0x8000000000000000ULL);
+  hy &= 0x7fffffffffffffffLL;
+  hx &= 0x7fffffffffffffffLL;
+
+  /* Purge off exception values.  */
+  if ((hy | ly) == 0)
+    return (x * y) / (x * y); 			/* y = 0 */
+  if ((hx >= 0x7fff000000000000LL)		/* x not finite */
+      || ((hy >= 0x7fff000000000000LL)		/* y is NaN */
+	  && (((hy - 0x7fff000000000000LL) | ly) != 0)))
+    return (x * y) / (x * y);
+
+  if (hy <= 0x7ffbffffffffffffLL)
+    x = fmodq (x, 8 * y);              /* now x < 8y */
+      
+  if (((hx - hy) | (lx - ly)) == 0)
+    {
+      *quo = qs ? -1 : 1;
+      return zero * x;
+    }
+
+  x  = fabsq (x);
+  y  = fabsq (y);
+  cquo = 0;
+
+  if (x >= 4 * y)
+    {
+      x -= 4 * y;
+      cquo += 4;
+    }
+  if (x >= 2 * y)
+    {
+      x -= 2 * y;
+      cquo += 2;
+    }
+
+  if (hy < 0x0002000000000000LL)
+    {
+      if (x + x > y)
+	{
+	  x -= y;
+	  ++cquo;
+	  if (x + x >= y)
+	    {
+	      x -= y;
+	      ++cquo;
+	    }
+	}
+    }
+  else
+    {
+      __float128 y_half = 0.5Q * y;
+      if (x > y_half)
+	{
+	  x -= y;
+	  ++cquo;
+	  if (x >= y_half)
+	    {
+	      x -= y;
+	      ++cquo;
+	    }
+	}
+    }
+
+  *quo = qs ? -cquo : cquo;
+
+  if (sx)
+    x = -x;
+  return x;
+}
--- libquadmath/math/cimagq.c.jj	2011-01-06 17:25:32.000000000 +0100
+++ libquadmath/math/cimagq.c	2011-01-06 17:25:32.000000000 +0100
@@ -0,0 +1,27 @@
+/* Return imaginary part of complex __float128 value.
+   Copyright (C) 1997, 1998 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
+
+   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, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include "quadmath-imp.h"
+
+__float128
+cimagq (__complex128 z)
+{
+  return __imag__ z;
+}
--- libquadmath/math/fdimq.c.jj	2011-01-06 17:31:48.000000000 +0100
+++ libquadmath/math/fdimq.c	2011-01-06 17:35:23.000000000 +0100
@@ -0,0 +1,43 @@
+/* Return positive difference between arguments.
+   Copyright (C) 1997, 2004, 2009 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
+
+   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, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <errno.h>
+#include "quadmath-imp.h"
+
+__float128
+fdimq (__float128 x, __float128 y)
+{
+  int clsx = fpclassifyq (x);
+  int clsy = fpclassifyq (y);
+
+  if (clsx == QUADFP_NAN || clsy == QUADFP_NAN
+      || (y < 0 && clsx == QUADFP_INFINITE && clsy == QUADFP_INFINITE))
+    /* Raise invalid flag.  */
+    return x - y;
+
+  if (x <= y)
+    return 0.0Q;
+
+  __float128 r = x - y;
+  if (isinfq (r))
+    errno = ERANGE;
+
+  return r;
+}
--- libquadmath/Makefile.in.jj	2011-01-06 17:25:22.000000000 +0100
+++ libquadmath/Makefile.in	2011-01-06 19:49:03.000000000 +0100
@@ -125,7 +125,14 @@ am__dirstamp = $(am__leading_dot)dirstam
 @BUILD_LIBQUADMATH_TRUE@	math/powq.lo math/fmaq.lo \
 @BUILD_LIBQUADMATH_TRUE@	math/cacoshq.lo math/cacosq.lo \
 @BUILD_LIBQUADMATH_TRUE@	math/casinhq.lo math/casinq.lo \
-@BUILD_LIBQUADMATH_TRUE@	math/catanhq.lo math/catanq.lo
+@BUILD_LIBQUADMATH_TRUE@	math/catanhq.lo math/catanq.lo \
+@BUILD_LIBQUADMATH_TRUE@	math/cimagq.lo math/conjq.lo \
+@BUILD_LIBQUADMATH_TRUE@	math/cprojq.lo math/crealq.lo \
+@BUILD_LIBQUADMATH_TRUE@	math/fdimq.lo math/fmaxq.lo \
+@BUILD_LIBQUADMATH_TRUE@	math/fminq.lo math/ilogbq.lo \
+@BUILD_LIBQUADMATH_TRUE@	math/llrintq.lo math/log2q.lo \
+@BUILD_LIBQUADMATH_TRUE@	math/lrintq.lo math/nearbyintq.lo \
+@BUILD_LIBQUADMATH_TRUE@	math/remquoq.lo
 libquadmath_la_OBJECTS = $(am_libquadmath_la_OBJECTS)
 libquadmath_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
 	$(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
@@ -327,7 +334,9 @@ AUTOMAKE_OPTIONS = 1.8 foreign
 @BUILD_LIBQUADMATH_TRUE@  math/nanq.c math/tgammaq.c math/finiteq.c math/nextafterq.c \
 @BUILD_LIBQUADMATH_TRUE@  math/truncq.c math/floorq.c math/powq.c math/fmaq.c \
 @BUILD_LIBQUADMATH_TRUE@  math/cacoshq.c math/cacosq.c math/casinhq.c math/casinq.c \
-@BUILD_LIBQUADMATH_TRUE@  math/catanhq.c math/catanq.c
+@BUILD_LIBQUADMATH_TRUE@  math/catanhq.c math/catanq.c math/cimagq.c math/conjq.c math/cprojq.c \
+@BUILD_LIBQUADMATH_TRUE@  math/crealq.c math/fdimq.c math/fmaxq.c math/fminq.c math/ilogbq.c \
+@BUILD_LIBQUADMATH_TRUE@  math/llrintq.c math/log2q.c math/lrintq.c math/nearbyintq.c math/remquoq.c
 
 
 # Work around what appears to be a GNU make bug handling MAKEFLAGS
@@ -578,6 +587,20 @@ math/casinhq.lo: math/$(am__dirstamp) ma
 math/casinq.lo: math/$(am__dirstamp) math/$(DEPDIR)/$(am__dirstamp)
 math/catanhq.lo: math/$(am__dirstamp) math/$(DEPDIR)/$(am__dirstamp)
 math/catanq.lo: math/$(am__dirstamp) math/$(DEPDIR)/$(am__dirstamp)
+math/cimagq.lo: math/$(am__dirstamp) math/$(DEPDIR)/$(am__dirstamp)
+math/conjq.lo: math/$(am__dirstamp) math/$(DEPDIR)/$(am__dirstamp)
+math/cprojq.lo: math/$(am__dirstamp) math/$(DEPDIR)/$(am__dirstamp)
+math/crealq.lo: math/$(am__dirstamp) math/$(DEPDIR)/$(am__dirstamp)
+math/fdimq.lo: math/$(am__dirstamp) math/$(DEPDIR)/$(am__dirstamp)
+math/fmaxq.lo: math/$(am__dirstamp) math/$(DEPDIR)/$(am__dirstamp)
+math/fminq.lo: math/$(am__dirstamp) math/$(DEPDIR)/$(am__dirstamp)
+math/ilogbq.lo: math/$(am__dirstamp) math/$(DEPDIR)/$(am__dirstamp)
+math/llrintq.lo: math/$(am__dirstamp) math/$(DEPDIR)/$(am__dirstamp)
+math/log2q.lo: math/$(am__dirstamp) math/$(DEPDIR)/$(am__dirstamp)
+math/lrintq.lo: math/$(am__dirstamp) math/$(DEPDIR)/$(am__dirstamp)
+math/nearbyintq.lo: math/$(am__dirstamp) \
+	math/$(DEPDIR)/$(am__dirstamp)
+math/remquoq.lo: math/$(am__dirstamp) math/$(DEPDIR)/$(am__dirstamp)
 libquadmath.la: $(libquadmath_la_OBJECTS) $(libquadmath_la_DEPENDENCIES) 
 	$(libquadmath_la_LINK) $(am_libquadmath_la_rpath) $(libquadmath_la_OBJECTS) $(libquadmath_la_LIBADD) $(LIBS)
 
@@ -641,8 +664,12 @@ mostlyclean-compile:
 	-rm -f math/cbrtq.lo
 	-rm -f math/ceilq.$(OBJEXT)
 	-rm -f math/ceilq.lo
+	-rm -f math/cimagq.$(OBJEXT)
+	-rm -f math/cimagq.lo
 	-rm -f math/complex.$(OBJEXT)
 	-rm -f math/complex.lo
+	-rm -f math/conjq.$(OBJEXT)
+	-rm -f math/conjq.lo
 	-rm -f math/copysignq.$(OBJEXT)
 	-rm -f math/copysignq.lo
 	-rm -f math/coshq.$(OBJEXT)
@@ -651,6 +678,10 @@ mostlyclean-compile:
 	-rm -f math/cosq.lo
 	-rm -f math/cosq_kernel.$(OBJEXT)
 	-rm -f math/cosq_kernel.lo
+	-rm -f math/cprojq.$(OBJEXT)
+	-rm -f math/cprojq.lo
+	-rm -f math/crealq.$(OBJEXT)
+	-rm -f math/crealq.lo
 	-rm -f math/erfq.$(OBJEXT)
 	-rm -f math/erfq.lo
 	-rm -f math/expm1q.$(OBJEXT)
@@ -659,18 +690,26 @@ mostlyclean-compile:
 	-rm -f math/expq.lo
 	-rm -f math/fabsq.$(OBJEXT)
 	-rm -f math/fabsq.lo
+	-rm -f math/fdimq.$(OBJEXT)
+	-rm -f math/fdimq.lo
 	-rm -f math/finiteq.$(OBJEXT)
 	-rm -f math/finiteq.lo
 	-rm -f math/floorq.$(OBJEXT)
 	-rm -f math/floorq.lo
 	-rm -f math/fmaq.$(OBJEXT)
 	-rm -f math/fmaq.lo
+	-rm -f math/fmaxq.$(OBJEXT)
+	-rm -f math/fmaxq.lo
+	-rm -f math/fminq.$(OBJEXT)
+	-rm -f math/fminq.lo
 	-rm -f math/fmodq.$(OBJEXT)
 	-rm -f math/fmodq.lo
 	-rm -f math/frexpq.$(OBJEXT)
 	-rm -f math/frexpq.lo
 	-rm -f math/hypotq.$(OBJEXT)
 	-rm -f math/hypotq.lo
+	-rm -f math/ilogbq.$(OBJEXT)
+	-rm -f math/ilogbq.lo
 	-rm -f math/isinfq.$(OBJEXT)
 	-rm -f math/isinfq.lo
 	-rm -f math/isnanq.$(OBJEXT)
@@ -685,20 +724,28 @@ mostlyclean-compile:
 	-rm -f math/ldexpq.lo
 	-rm -f math/lgammaq.$(OBJEXT)
 	-rm -f math/lgammaq.lo
+	-rm -f math/llrintq.$(OBJEXT)
+	-rm -f math/llrintq.lo
 	-rm -f math/llroundq.$(OBJEXT)
 	-rm -f math/llroundq.lo
 	-rm -f math/log10q.$(OBJEXT)
 	-rm -f math/log10q.lo
 	-rm -f math/log1pq.$(OBJEXT)
 	-rm -f math/log1pq.lo
+	-rm -f math/log2q.$(OBJEXT)
+	-rm -f math/log2q.lo
 	-rm -f math/logq.$(OBJEXT)
 	-rm -f math/logq.lo
+	-rm -f math/lrintq.$(OBJEXT)
+	-rm -f math/lrintq.lo
 	-rm -f math/lroundq.$(OBJEXT)
 	-rm -f math/lroundq.lo
 	-rm -f math/modfq.$(OBJEXT)
 	-rm -f math/modfq.lo
 	-rm -f math/nanq.$(OBJEXT)
 	-rm -f math/nanq.lo
+	-rm -f math/nearbyintq.$(OBJEXT)
+	-rm -f math/nearbyintq.lo
 	-rm -f math/nextafterq.$(OBJEXT)
 	-rm -f math/nextafterq.lo
 	-rm -f math/powq.$(OBJEXT)
@@ -707,6 +754,8 @@ mostlyclean-compile:
 	-rm -f math/rem_pio2q.lo
 	-rm -f math/remainderq.$(OBJEXT)
 	-rm -f math/remainderq.lo
+	-rm -f math/remquoq.$(OBJEXT)
+	-rm -f math/remquoq.lo
 	-rm -f math/rintq.$(OBJEXT)
 	-rm -f math/rintq.lo
 	-rm -f math/roundq.$(OBJEXT)
@@ -773,21 +822,29 @@ distclean-compile:
 @AMDEP_TRUE@@am__include@ @am__quote@math/$(DEPDIR)/catanq.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@math/$(DEPDIR)/cbrtq.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@math/$(DEPDIR)/ceilq.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@math/$(DEPDIR)/cimagq.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@math/$(DEPDIR)/complex.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@math/$(DEPDIR)/conjq.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@math/$(DEPDIR)/copysignq.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@math/$(DEPDIR)/coshq.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@math/$(DEPDIR)/cosq.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@math/$(DEPDIR)/cosq_kernel.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@math/$(DEPDIR)/cprojq.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@math/$(DEPDIR)/crealq.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@math/$(DEPDIR)/erfq.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@math/$(DEPDIR)/expm1q.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@math/$(DEPDIR)/expq.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@math/$(DEPDIR)/fabsq.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@math/$(DEPDIR)/fdimq.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@math/$(DEPDIR)/finiteq.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@math/$(DEPDIR)/floorq.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@math/$(DEPDIR)/fmaq.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@math/$(DEPDIR)/fmaxq.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@math/$(DEPDIR)/fminq.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@math/$(DEPDIR)/fmodq.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@math/$(DEPDIR)/frexpq.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@math/$(DEPDIR)/hypotq.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@math/$(DEPDIR)/ilogbq.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@math/$(DEPDIR)/isinfq.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@math/$(DEPDIR)/isnanq.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@math/$(DEPDIR)/j0q.Plo@am__quote@
@@ -795,17 +852,22 @@ distclean-compile:
 @AMDEP_TRUE@@am__include@ @am__quote@math/$(DEPDIR)/jnq.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@math/$(DEPDIR)/ldexpq.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@math/$(DEPDIR)/lgammaq.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@math/$(DEPDIR)/llrintq.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@math/$(DEPDIR)/llroundq.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@math/$(DEPDIR)/log10q.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@math/$(DEPDIR)/log1pq.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@math/$(DEPDIR)/log2q.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@math/$(DEPDIR)/logq.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@math/$(DEPDIR)/lrintq.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@math/$(DEPDIR)/lroundq.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@math/$(DEPDIR)/modfq.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@math/$(DEPDIR)/nanq.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@math/$(DEPDIR)/nearbyintq.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@math/$(DEPDIR)/nextafterq.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@math/$(DEPDIR)/powq.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@math/$(DEPDIR)/rem_pio2q.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@math/$(DEPDIR)/remainderq.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@math/$(DEPDIR)/remquoq.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@math/$(DEPDIR)/rintq.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@math/$(DEPDIR)/roundq.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@math/$(DEPDIR)/scalblnq.Plo@am__quote@

	Jakub


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]