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]

Re: [PATCH] Add ca{sin,cos,tan}{,h}q to libquadmath, fix atan2q (PR fortran/46416)


On Thu, Jan 06, 2011 at 01:17:35AM +0100, Jakub Jelinek wrote:
> This patch adds a couple of complex routines from glibc and fixes a quite
> severe bug in atan2q which caused very big errors in it (discovered by
> seeing cacoshq giving terribly non-precise results).
> 
> Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk?

Forgot to add it into quadmath-weak.h, here is an updated patch (also
bootstrapped/regtested on x86_64-linux and i686-linux):

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

	PR fortran/46416
	* quadmath.h (cacosq, cacoshq, casinq, casinhq, catanq, catanhq):
	New prototypes.
	(M_Eq, M_LOG2Eq, M_LOG10Eq, M_LN2q, M_LN10q, M_PIq, M_PI_2q, M_PI_4q,
	M_1_PIq, M_2_PIq, M_2_SQRTPIq, M_SQRT2q, M_SQRT1_2q): Define.
	* quadmath_weak.h (cacosq, cacoshq, casinq, casinhq, catanq,
	catanhq): Add.
	* quadmath-imp.h (fpclassifyq, QUADFP_NAN, QUADFP_INFINITE,
	QUADFP_ZERO, QUADFP_SUBNORMAL, QUADFP_NORMAL): Define.
	* quadmath.map (QUADMATH_1.0): Add cacosq, cacoshq, casinq, casinhq,
	catanq and catanhq.
	* Makefile.am (libquadmath_la_SOURCES): Add math/cacosq.c,
	math/cacoshq.c, math/casinq.c, math/casinhq.c, math/catanq.c
	and math/catanhq.c.
	* Makefile.in: Regenerated.
	* libquadmath.texi (cacosq, cacoshq, casinq, casinhq,
	catanq, catanhq): Add.
	* math/cacoshq.c: New file.
	* math/cacosq.c: New file.
	* math/catanq.c: New file.
	* math/catanhq.c: New file.
	* math/casinq.c: New file.
	* math/casinhq.c: New file.

	* math/hypotq.c (hypotq): Use Q suffix instead of L.
	* math/atan2q.c (tiny, pi_o_4, pi_o_2, pi, pi_lo, atan2q): Likewise.
	* math/cosq.c (cosq): Likewise.

--- libquadmath/quadmath.h.jj	2011-01-05 16:41:59.000000000 +0100
+++ libquadmath/quadmath.h	2011-01-05 18:14:21.000000000 +0100
@@ -90,6 +90,12 @@ extern __float128 ynq (int, __float128);
 // Prototypes for complex functions
 extern __float128 cabsq (__complex128);
 extern __float128 cargq (__complex128);
+extern __complex128 cacosq (__complex128);
+extern __complex128 cacoshq (__complex128);
+extern __complex128 casinq (__complex128);
+extern __complex128 casinhq (__complex128);
+extern __complex128 catanq (__complex128);
+extern __complex128 catanhq (__complex128);
 extern __complex128 ccosq (__complex128);
 extern __complex128 ccoshq (__complex128);
 extern __complex128 cexpq (__complex128);
@@ -126,4 +132,18 @@ extern void quadmath_dtoaq (char *, size
    (floating constant exceeds range of â__float128â)  */
 /* #define HUGE_VALQ (__extension__ 0x1.0p32767Q) */
 
+#define M_Eq		2.7182818284590452353602874713526625Q  /* e */
+#define M_LOG2Eq	1.4426950408889634073599246810018921Q  /* log_2 e */
+#define M_LOG10Eq	0.4342944819032518276511289189166051Q  /* log_10 e */
+#define M_LN2q		0.6931471805599453094172321214581766Q  /* log_e 2 */
+#define M_LN10q		2.3025850929940456840179914546843642Q  /* log_e 10 */
+#define M_PIq		3.1415926535897932384626433832795029Q  /* pi */
+#define M_PI_2q		1.5707963267948966192313216916397514Q  /* pi/2 */
+#define M_PI_4q		0.7853981633974483096156608458198757Q  /* pi/4 */
+#define M_1_PIq		0.3183098861837906715377675267450287Q  /* 1/pi */
+#define M_2_PIq		0.6366197723675813430755350534900574Q  /* 2/pi */
+#define M_2_SQRTPIq	1.1283791670955125738961589031215452Q  /* 2/sqrt(pi) */
+#define M_SQRT2q	1.4142135623730950488016887242096981Q  /* sqrt(2) */
+#define M_SQRT1_2q	0.7071067811865475244008443621048490Q  /* 1/sqrt(2) */
+
 #endif
--- libquadmath/quadmath-imp.h.jj	2010-12-14 08:11:24.000000000 +0100
+++ libquadmath/quadmath-imp.h	2011-01-05 17:33:00.000000000 +0100
@@ -164,5 +164,13 @@ do {                                   \
 
 #define IEEE854_FLOAT128_BIAS 0x3fff
 
+#define QUADFP_NAN		0
+#define QUADFP_INFINITE		1
+#define QUADFP_ZERO		2
+#define QUADFP_SUBNORMAL	3
+#define QUADFP_NORMAL		4
+#define fpclassifyq(x) \
+  __builtin_fpclassify (QUADFP_NAN, QUADFP_INFINITE, QUADFP_NORMAL, \
+			QUADFP_SUBNORMAL, QUADFP_ZERO, x)
 
 #endif
--- libquadmath/quadmath.map.jj	2011-01-05 15:27:46.000000000 +0100
+++ libquadmath/quadmath.map	2011-01-05 17:55:51.000000000 +0100
@@ -7,6 +7,12 @@ QUADMATH_1.0 {
     atanq;
     atanhq;
     atan2q;
+    cacoshq;
+    cacosq;
+    casinhq;
+    casinq;
+    catanhq;
+    catanq;
     cbrtq;
     ceilq;
     copysignq;
--- libquadmath/Makefile.am.jj	2011-01-05 15:26:00.000000000 +0100
+++ libquadmath/Makefile.am	2011-01-05 17:56:53.000000000 +0100
@@ -61,7 +61,9 @@ libquadmath_la_SOURCES = \
   math/erfq.c math/logq.c math/sqrtq.c math/expm1q.c math/lroundq.c \
   math/tanhq.c math/expq.c math/modfq.c math/tanq.c math/fabsq.c \
   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/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
 
 # 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/libquadmath.texi.jj	2011-01-05 19:33:17.000000000 +0100
+++ libquadmath/libquadmath.texi	2011-01-05 19:58:17.000000000 +0100
@@ -154,9 +154,16 @@ The following mathematical functions are
 @item @code{ynq}: Bessel function of the second kind, @var{n}-th order
 @item @code{cabsq} complex absolute value function:
 @item @code{cargq}: calculate the argument
+@item @code{cacoshq}: complex arc hyperbolic cosine function
+@item @code{cacosq}: complex arc cosine function
+@item @code{casinhq}: complex arc hyperbolic sine function
+@item @code{casinq}: complex arc sine function
+@item @code{catanhq}: complex arc hyperbolic tangent function
+@item @code{catanq}: complex arc tangent function
 @item @code{ccosq} complex cosine function:
 @item @code{ccoshq}: complex hyperbolic cosine function
 @item @code{cexpq}: complex exponential function
+@need 800
 @item @code{cexpiq}: computes the exponential function of ``i'' times a
                      real value
 @item @code{clogq}: complex natural logarithm
@@ -164,7 +171,6 @@ The following mathematical functions are
 @item @code{cpowq}: complex power function
 @item @code{csinq}: complex sine function
 @item @code{csinhq}: complex hyperbolic sine function
-@need 800
 @item @code{csqrtq}: complex square root
 @item @code{ctanq}: complex tangent function
 @item @code{ctanhq}: complex hyperbolic tangent function
--- libquadmath/math/cacoshq.c.jj	2011-01-05 17:18:18.000000000 +0100
+++ libquadmath/math/cacoshq.c	2011-01-05 21:23:28.000000000 +0100
@@ -0,0 +1,89 @@
+/* Return arc hyperbole cosine for __float128 value.
+   Copyright (C) 1997, 1998, 2006 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
+cacoshq (__complex128 x)
+{
+  __complex128 res;
+  int rcls = fpclassifyq (__real__ x);
+  int icls = fpclassifyq (__imag__ x);
+
+  if (rcls <= QUADFP_INFINITE || icls <= QUADFP_INFINITE)
+    {
+      if (icls == QUADFP_INFINITE)
+	{
+	  __real__ res = HUGE_VALQ;
+
+	  if (rcls == QUADFP_NAN)
+	    __imag__ res = nanq ("");
+	  else
+	    __imag__ res = copysignq ((rcls == QUADFP_INFINITE
+				       ? (__real__ x < 0.0
+					  ? M_PIq - M_PI_4q : M_PI_4q)
+				       : M_PI_2q), __imag__ x);
+	}
+      else if (rcls == QUADFP_INFINITE)
+	{
+	  __real__ res = HUGE_VALQ;
+
+	  if (icls >= QUADFP_ZERO)
+	    __imag__ res = copysignq (signbitq (__real__ x) ? M_PIq : 0.0,
+				      __imag__ x);
+	  else
+	    __imag__ res = nanq ("");
+	}
+      else
+	{
+	  __real__ res = nanq ("");
+	  __imag__ res = nanq ("");
+	}
+    }
+  else if (rcls == QUADFP_ZERO && icls == QUADFP_ZERO)
+    {
+      __real__ res = 0.0;
+      __imag__ res = copysignq (M_PI_2q, __imag__ x);
+    }
+  else
+    {
+      __complex128 y;
+
+      __real__ y = (__real__ x - __imag__ x) * (__real__ x + __imag__ x) - 1.0;
+      __imag__ y = 2.0 * __real__ x * __imag__ x;
+
+      y = csqrtq (y);
+
+      if (__real__ x < 0.0)
+	y = -y;
+
+      __real__ y += __real__ x;
+      __imag__ y += __imag__ x;
+
+      res = clogq (y);
+
+      /* We have to use the positive branch.  */
+      if (__real__ res < 0.0)
+	res = -res;
+    }
+
+  return res;
+}
--- libquadmath/math/cacosq.c.jj	2011-01-05 17:18:18.000000000 +0100
+++ libquadmath/math/cacosq.c	2011-01-05 21:23:37.000000000 +0100
@@ -0,0 +1,35 @@
+/* Return cosine 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
+cacosq (__complex128 x)
+{
+  __complex128 y;
+  __complex128 res;
+
+  y = casinq (x);
+
+  __real__ res = M_PI_2q - __real__ y;
+  __imag__ res = -__imag__ y;
+
+  return res;
+}
--- libquadmath/math/catanq.c.jj	2011-01-05 17:18:18.000000000 +0100
+++ libquadmath/math/catanq.c	2011-01-05 21:24:06.000000000 +0100
@@ -0,0 +1,81 @@
+/* Return arc tangent 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
+catanq (__complex128 x)
+{
+  __complex128 res;
+  int rcls = fpclassifyq (__real__ x);
+  int icls = fpclassifyq (__imag__ x);
+
+  if (rcls <= QUADFP_INFINITE || icls <= QUADFP_INFINITE)
+    {
+      if (rcls == QUADFP_INFINITE)
+	{
+	  __real__ res = copysignq (M_PI_2q, __real__ x);
+	  __imag__ res = copysignq (0.0, __imag__ x);
+	}
+      else if (icls == QUADFP_INFINITE)
+	{
+	  if (rcls >= QUADFP_ZERO)
+	    __real__ res = copysignq (M_PI_2q, __real__ x);
+	  else
+	    __real__ res = nanq ("");
+	  __imag__ res = copysignq (0.0, __imag__ x);
+	}
+      else if (icls == QUADFP_ZERO || icls == QUADFP_INFINITE)
+	{
+	  __real__ res = nanq ("");
+	  __imag__ res = copysignq (0.0, __imag__ x);
+	}
+      else
+	{
+	  __real__ res = nanq ("");
+	  __imag__ res = nanq ("");
+	}
+    }
+  else if (rcls == QUADFP_ZERO && icls == QUADFP_ZERO)
+    {
+      res = x;
+    }
+  else
+    {
+      __float128 r2, num, den;
+
+      r2 = __real__ x * __real__ x;
+
+      den = 1 - r2 - __imag__ x * __imag__ x;
+
+      __real__ res = 0.5 * atan2q (2.0 * __real__ x, den);
+
+      num = __imag__ x + 1.0;
+      num = r2 + num * num;
+
+      den = __imag__ x - 1.0;
+      den = r2 + den * den;
+
+      __imag__ res = 0.25 * logq (num / den);
+    }
+
+  return res;
+}
--- libquadmath/math/catanhq.c.jj	2011-01-05 17:18:18.000000000 +0100
+++ libquadmath/math/catanhq.c	2011-01-05 21:24:00.000000000 +0100
@@ -0,0 +1,76 @@
+/* Return arc hyperbole tangent for __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
+catanhq (__complex128 x)
+{
+  __complex128 res;
+  int rcls = fpclassifyq (__real__ x);
+  int icls = fpclassifyq (__imag__ x);
+
+  if (rcls <= QUADFP_INFINITE || icls <= QUADFP_INFINITE)
+    {
+      if (icls == QUADFP_INFINITE)
+	{
+	  __real__ res = copysignq (0.0, __real__ x);
+	  __imag__ res = copysignq (M_PI_2q, __imag__ x);
+	}
+      else if (rcls == QUADFP_INFINITE || rcls == QUADFP_ZERO)
+	{
+	  __real__ res = copysignq (0.0, __real__ x);
+	  if (icls >= QUADFP_ZERO)
+	    __imag__ res = copysignq (M_PI_2q, __imag__ x);
+	  else
+	    __imag__ res = nanq ("");
+	}
+      else
+	{
+	  __real__ res = nanq ("");
+	  __imag__ res = nanq ("");
+	}
+    }
+  else if (rcls == QUADFP_ZERO && icls == QUADFP_ZERO)
+    {
+      res = x;
+    }
+  else
+    {
+      __float128 i2, num, den;
+
+      i2 = __imag__ x * __imag__ x;
+
+      num = 1.0 + __real__ x;
+      num = i2 + num * num;
+
+      den = 1.0 - __real__ x;
+      den = i2 + den * den;
+
+      __real__ res = 0.25 * (logq (num) - logq (den));
+
+      den = 1 - __real__ x * __real__ x - i2;
+
+      __imag__ res = 0.5 * atan2q (2.0 * __imag__ x, den);
+    }
+
+  return res;
+}
--- libquadmath/math/casinq.c.jj	2011-01-05 17:18:18.000000000 +0100
+++ libquadmath/math/casinq.c	2011-01-05 21:23:51.000000000 +0100
@@ -0,0 +1,60 @@
+/* Return arc sine of complex __float128 value.
+   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"
+
+
+__complex128
+casinq (__complex128 x)
+{
+  __complex128 res;
+
+  if (isnanq (__real__ x) || isnanq (__imag__ x))
+    {
+      if (__real__ x == 0.0)
+	{
+	  res = x;
+	}
+      else if (isinfq (__real__ x) || isinfq (__imag__ x))
+	{
+	  __real__ res = nanq ("");
+	  __imag__ res = copysignq (HUGE_VALQ, __imag__ x);
+	}
+      else
+	{
+	  __real__ res = nanq ("");
+	  __imag__ res = nanq ("");
+	}
+    }
+  else
+    {
+      __complex128 y;
+
+      __real__ y = -__imag__ x;
+      __imag__ y = __real__ x;
+
+      y = casinhq (y);
+
+      __real__ res = __imag__ y;
+      __imag__ res = -__real__ y;
+    }
+
+  return res;
+}
--- libquadmath/math/casinhq.c.jj	2011-01-05 17:18:18.000000000 +0100
+++ libquadmath/math/casinhq.c	2011-01-05 21:23:45.000000000 +0100
@@ -0,0 +1,78 @@
+/* Return arc hyperbole sine for __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
+casinhq (__complex128 x)
+{
+  __complex128 res;
+  int rcls = fpclassifyq (__real__ x);
+  int icls = fpclassifyq (__imag__ x);
+
+  if (rcls <= QUADFP_INFINITE || icls <= QUADFP_INFINITE)
+    {
+      if (icls == QUADFP_INFINITE)
+	{
+	  __real__ res = copysignq (HUGE_VALQ, __real__ x);
+
+	  if (rcls == QUADFP_NAN)
+	    __imag__ res = nanq ("");
+	  else
+	    __imag__ res = copysignq (rcls >= QUADFP_ZERO ? M_PI_2q : M_PI_4q,
+				      __imag__ x);
+	}
+      else if (rcls <= QUADFP_INFINITE)
+	{
+	  __real__ res = __real__ x;
+	  if ((rcls == QUADFP_INFINITE && icls >= QUADFP_ZERO)
+	      || (rcls == QUADFP_NAN && icls == QUADFP_ZERO))
+	    __imag__ res = copysignq (0.0, __imag__ x);
+	  else
+	    __imag__ res = nanq ("");
+	}
+      else
+	{
+	  __real__ res = nanq ("");
+	  __imag__ res = nanq ("");
+	}
+    }
+  else if (rcls == QUADFP_ZERO && icls == QUADFP_ZERO)
+    {
+      res = x;
+    }
+  else
+    {
+      __complex128 y;
+
+      __real__ y = (__real__ x - __imag__ x) * (__real__ x + __imag__ x) + 1.0;
+      __imag__ y = 2.0 * __real__ x * __imag__ x;
+
+      y = csqrtq (y);
+
+      __real__ y += __real__ x;
+      __imag__ y += __imag__ x;
+
+      res = clogq (y);
+    }
+
+  return res;
+}
--- libquadmath/quadmath_weak.h.jj	2011-01-06 16:04:10.000000000 +0100
+++ libquadmath/quadmath_weak.h	2011-01-06 16:05:21.881539095 +0100
@@ -97,6 +97,12 @@ __qmath3 (ynq)
 // Prototypes for complex functions
 __qmath3 (cabsq)
 __qmath3 (cargq)
+__qmath3 (cacosq)
+__qmath3 (cacoshq)
+__qmath3 (casinq)
+__qmath3 (casinhq)
+__qmath3 (catanq)
+__qmath3 (catanhq)
 __qmath3 (ccosq)
 __qmath3 (ccoshq)
 __qmath3 (cexpq)
--- libquadmath/math/hypotq.c.jj	2010-11-19 20:56:37.000000000 +0100
+++ libquadmath/math/hypotq.c	2011-01-05 22:00:04.000000000 +0100
@@ -116,7 +116,7 @@ hypotq (__float128 x, __float128 y)
   }
   if(k!=0) {
       uint64_t high;
-      t1 = 1.0L;
+      t1 = 1.0Q;
       GET_FLT128_MSW64(high,t1);
       SET_FLT128_MSW64(t1,high+(k<<48));
       return t1*w;
--- libquadmath/math/atan2q.c.jj	2010-11-19 20:56:37.000000000 +0100
+++ libquadmath/math/atan2q.c	2011-01-05 21:59:03.000000000 +0100
@@ -43,12 +43,12 @@
 #include "quadmath-imp.h"
 
 static const __float128
-tiny  = 1.0e-4900L,
+tiny  = 1.0e-4900Q,
 zero  = 0.0,
-pi_o_4  = 7.85398163397448309615660845819875699e-01L, /* 3ffe921fb54442d18469898cc51701b8 */
-pi_o_2  = 1.57079632679489661923132169163975140e+00L, /* 3fff921fb54442d18469898cc51701b8 */
-pi      = 3.14159265358979323846264338327950280e+00L, /* 4000921fb54442d18469898cc51701b8 */
-pi_lo   = 8.67181013012378102479704402604335225e-35L; /* 3f8dcd129024e088a67cc74020bbea64 */
+pi_o_4  = 7.85398163397448309615660845819875699e-01Q, /* 3ffe921fb54442d18469898cc51701b8 */
+pi_o_2  = 1.57079632679489661923132169163975140e+00Q, /* 3fff921fb54442d18469898cc51701b8 */
+pi      = 3.14159265358979323846264338327950280e+00Q, /* 4000921fb54442d18469898cc51701b8 */
+pi_lo   = 8.67181013012378102479704402604335225e-35Q; /* 3f8dcd129024e088a67cc74020bbea64 */
 
 __float128
 atan2q (__float128 y, __float128 x)
@@ -64,7 +64,7 @@ atan2q (__float128 y, __float128 x)
 	if(((ix|((lx|-lx)>>63))>0x7fff000000000000LL)||
 	   ((iy|((ly|-ly)>>63))>0x7fff000000000000LL))	/* x or y is NaN */
 	   return x+y;
-	if(((hx-0x3fff000000000000LL)|lx)==0) return atanq(y);   /* x=1.0L */
+	if(((hx-0x3fff000000000000LL)|lx)==0) return atanq(y);   /* x=1.0Q */
 	m = ((hy>>63)&1)|((hx>>62)&2);	/* 2*sign(x)+sign(y) */
 
     /* when y = 0 */
@@ -85,8 +85,8 @@ atan2q (__float128 y, __float128 x)
 		switch(m) {
 		    case 0: return  pi_o_4+tiny;/* atan(+INF,+INF) */
 		    case 1: return -pi_o_4-tiny;/* atan(-INF,+INF) */
-		    case 2: return  3.0L*pi_o_4+tiny;/*atan(+INF,-INF)*/
-		    case 3: return -3.0L*pi_o_4-tiny;/*atan(-INF,-INF)*/
+		    case 2: return  3.0Q*pi_o_4+tiny;/*atan(+INF,-INF)*/
+		    case 3: return -3.0Q*pi_o_4-tiny;/*atan(-INF,-INF)*/
 		}
 	    } else {
 		switch(m) {
@@ -102,8 +102,8 @@ atan2q (__float128 y, __float128 x)
 
     /* compute y/x */
 	k = (iy-ix)>>48;
-	if(k > 120) z=pi_o_2+0.5L*pi_lo; 	/* |y/x| >  2**120 */
-	else if(hx<0&&k<-120) z=0.0L; 		/* |y|/x < -2**120 */
+	if(k > 120) z=pi_o_2+0.5Q*pi_lo; 	/* |y/x| >  2**120 */
+	else if(hx<0&&k<-120) z=0.0Q; 		/* |y|/x < -2**120 */
 	else z=atanq(fabsq(y/x));		/* safe to do y/x */
 	switch (m) {
 	    case 0: return       z  ;	/* atan(+,+) */
--- libquadmath/math/cosq.c.jj	2010-12-14 08:11:24.000000000 +0100
+++ libquadmath/math/cosq.c	2011-01-05 21:59:19.000000000 +0100
@@ -49,7 +49,7 @@
 __float128
 cosq (__float128 x)
 {
-	__float128 y[2],z=0.0L;
+	__float128 y[2],z=0.0Q;
 	int64_t n, ix;
 
     /* High word of x. */
--- libquadmath/Makefile.in.jj	2011-01-05 16:08:55.000000000 +0100
+++ libquadmath/Makefile.in	2011-01-05 17:57:12.000000000 +0100
@@ -122,7 +122,10 @@ am__dirstamp = $(am__leading_dot)dirstam
 @BUILD_LIBQUADMATH_TRUE@	math/nanq.lo math/tgammaq.lo \
 @BUILD_LIBQUADMATH_TRUE@	math/finiteq.lo math/nextafterq.lo \
 @BUILD_LIBQUADMATH_TRUE@	math/truncq.lo math/floorq.lo \
-@BUILD_LIBQUADMATH_TRUE@	math/powq.lo math/fmaq.lo
+@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
 libquadmath_la_OBJECTS = $(am_libquadmath_la_OBJECTS)
 libquadmath_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
 	$(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
@@ -322,7 +325,9 @@ AUTOMAKE_OPTIONS = 1.8 foreign
 @BUILD_LIBQUADMATH_TRUE@  math/erfq.c math/logq.c math/sqrtq.c math/expm1q.c math/lroundq.c \
 @BUILD_LIBQUADMATH_TRUE@  math/tanhq.c math/expq.c math/modfq.c math/tanq.c math/fabsq.c \
 @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/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
 
 
 # Work around what appears to be a GNU make bug handling MAKEFLAGS
@@ -567,6 +572,12 @@ math/truncq.lo: math/$(am__dirstamp) mat
 math/floorq.lo: math/$(am__dirstamp) math/$(DEPDIR)/$(am__dirstamp)
 math/powq.lo: math/$(am__dirstamp) math/$(DEPDIR)/$(am__dirstamp)
 math/fmaq.lo: math/$(am__dirstamp) math/$(DEPDIR)/$(am__dirstamp)
+math/cacoshq.lo: math/$(am__dirstamp) math/$(DEPDIR)/$(am__dirstamp)
+math/cacosq.lo: math/$(am__dirstamp) math/$(DEPDIR)/$(am__dirstamp)
+math/casinhq.lo: math/$(am__dirstamp) math/$(DEPDIR)/$(am__dirstamp)
+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)
 libquadmath.la: $(libquadmath_la_OBJECTS) $(libquadmath_la_DEPENDENCIES) 
 	$(libquadmath_la_LINK) $(am_libquadmath_la_rpath) $(libquadmath_la_OBJECTS) $(libquadmath_la_LIBADD) $(LIBS)
 
@@ -614,6 +625,18 @@ mostlyclean-compile:
 	-rm -f math/atanhq.lo
 	-rm -f math/atanq.$(OBJEXT)
 	-rm -f math/atanq.lo
+	-rm -f math/cacoshq.$(OBJEXT)
+	-rm -f math/cacoshq.lo
+	-rm -f math/cacosq.$(OBJEXT)
+	-rm -f math/cacosq.lo
+	-rm -f math/casinhq.$(OBJEXT)
+	-rm -f math/casinhq.lo
+	-rm -f math/casinq.$(OBJEXT)
+	-rm -f math/casinq.lo
+	-rm -f math/catanhq.$(OBJEXT)
+	-rm -f math/catanhq.lo
+	-rm -f math/catanq.$(OBJEXT)
+	-rm -f math/catanq.lo
 	-rm -f math/cbrtq.$(OBJEXT)
 	-rm -f math/cbrtq.lo
 	-rm -f math/ceilq.$(OBJEXT)
@@ -742,6 +765,12 @@ distclean-compile:
 @AMDEP_TRUE@@am__include@ @am__quote@math/$(DEPDIR)/atan2q.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@math/$(DEPDIR)/atanhq.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@math/$(DEPDIR)/atanq.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@math/$(DEPDIR)/cacoshq.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@math/$(DEPDIR)/cacosq.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@math/$(DEPDIR)/casinhq.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@math/$(DEPDIR)/casinq.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@math/$(DEPDIR)/catanhq.Plo@am__quote@
+@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)/complex.Plo@am__quote@

	Jakub


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