OSDN Git Service

PR fortran/46416
authorjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>
Sun, 16 Jan 2011 16:42:37 +0000 (16:42 +0000)
committerjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>
Sun, 16 Jan 2011 16:42:37 +0000 (16:42 +0000)
* 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.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@168853 138bc75d-0d04-0410-961f-82ee72b054a4

17 files changed:
libquadmath/ChangeLog
libquadmath/Makefile.am
libquadmath/Makefile.in
libquadmath/libquadmath.texi
libquadmath/math/atan2q.c
libquadmath/math/cacoshq.c [new file with mode: 0644]
libquadmath/math/cacosq.c [new file with mode: 0644]
libquadmath/math/casinhq.c [new file with mode: 0644]
libquadmath/math/casinq.c [new file with mode: 0644]
libquadmath/math/catanhq.c [new file with mode: 0644]
libquadmath/math/catanq.c [new file with mode: 0644]
libquadmath/math/cosq.c
libquadmath/math/hypotq.c
libquadmath/quadmath-imp.h
libquadmath/quadmath.h
libquadmath/quadmath.map
libquadmath/quadmath_weak.h

index 1cb4aa0..b7b7a43 100644 (file)
@@ -1,5 +1,33 @@
 2011-01-16  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.
+
        PR fortran/46402
        * quadmath.map (QUADMATH_1.0): Add fmaq.
        * configure.ac: Check for fenv.h, feholdexcept, fesetround,
index c4bd0e4..0a5c27f 100644 (file)
@@ -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
index a241b13..2fdebeb 100644 (file)
@@ -122,7 +122,10 @@ am__dirstamp = $(am__leading_dot)dirstamp
 @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) \
@@ -324,7 +327,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
@@ -570,6 +575,12 @@ math/truncq.lo: math/$(am__dirstamp) math/$(DEPDIR)/$(am__dirstamp)
 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)
 
@@ -617,6 +628,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)
@@ -745,6 +768,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@
index aba777b..50b9e62 100644 (file)
@@ -154,9 +154,16 @@ The following mathematical functions are available:
 @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 available:
 @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
index 9d24dcc..fbe64d6 100644 (file)
 #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(+,+) */
diff --git a/libquadmath/math/cacoshq.c b/libquadmath/math/cacoshq.c
new file mode 100644 (file)
index 0000000..8acc570
--- /dev/null
@@ -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;
+}
diff --git a/libquadmath/math/cacosq.c b/libquadmath/math/cacosq.c
new file mode 100644 (file)
index 0000000..3c257b0
--- /dev/null
@@ -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;
+}
diff --git a/libquadmath/math/casinhq.c b/libquadmath/math/casinhq.c
new file mode 100644 (file)
index 0000000..ffa45fa
--- /dev/null
@@ -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;
+}
diff --git a/libquadmath/math/casinq.c b/libquadmath/math/casinq.c
new file mode 100644 (file)
index 0000000..122ef5d
--- /dev/null
@@ -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;
+}
diff --git a/libquadmath/math/catanhq.c b/libquadmath/math/catanhq.c
new file mode 100644 (file)
index 0000000..6a86e2d
--- /dev/null
@@ -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;
+}
diff --git a/libquadmath/math/catanq.c b/libquadmath/math/catanq.c
new file mode 100644 (file)
index 0000000..a9c9257
--- /dev/null
@@ -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;
+}
index 1695551..dc321a2 100644 (file)
@@ -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. */
index e4c2d1b..2df317f 100644 (file)
@@ -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;
index ac9359b..5404c9e 100644 (file)
@@ -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
index 5fe9549..bc41337 100644 (file)
@@ -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_t, size_t, __float128);
    (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
index f70cda1..2a66287 100644 (file)
@@ -7,6 +7,12 @@ QUADMATH_1.0 {
     atanq;
     atanhq;
     atan2q;
+    cacoshq;
+    cacosq;
+    casinhq;
+    casinq;
+    catanhq;
+    catanq;
     cbrtq;
     ceilq;
     copysignq;
index 05b0438..d2c3d86 100644 (file)
@@ -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)