summaryrefslogtreecommitdiff
path: root/libquadmath
diff options
context:
space:
mode:
authorjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>2011-01-16 16:42:37 +0000
committerjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>2011-01-16 16:42:37 +0000
commitb12676a5853278cf006fbc0908d35cb9d5ba7adc (patch)
treed5f9fa3730934400e8a107bce022ccd7da1bcf83 /libquadmath
parentbcaa791fa18f28ae60c3bb1adc2594749123a026 (diff)
downloadgcc-b12676a5853278cf006fbc0908d35cb9d5ba7adc.tar.gz
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. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@168853 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libquadmath')
-rw-r--r--libquadmath/ChangeLog28
-rw-r--r--libquadmath/Makefile.am4
-rw-r--r--libquadmath/Makefile.in33
-rw-r--r--libquadmath/libquadmath.texi8
-rw-r--r--libquadmath/math/atan2q.c20
-rw-r--r--libquadmath/math/cacoshq.c89
-rw-r--r--libquadmath/math/cacosq.c35
-rw-r--r--libquadmath/math/casinhq.c78
-rw-r--r--libquadmath/math/casinq.c60
-rw-r--r--libquadmath/math/catanhq.c76
-rw-r--r--libquadmath/math/catanq.c81
-rw-r--r--libquadmath/math/cosq.c2
-rw-r--r--libquadmath/math/hypotq.c2
-rw-r--r--libquadmath/quadmath-imp.h8
-rw-r--r--libquadmath/quadmath.h20
-rw-r--r--libquadmath/quadmath.map6
-rw-r--r--libquadmath/quadmath_weak.h6
17 files changed, 540 insertions, 16 deletions
diff --git a/libquadmath/ChangeLog b/libquadmath/ChangeLog
index 1cb4aa0a383..b7b7a43aa6b 100644
--- a/libquadmath/ChangeLog
+++ b/libquadmath/ChangeLog
@@ -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,
diff --git a/libquadmath/Makefile.am b/libquadmath/Makefile.am
index c4bd0e43bae..0a5c27f4875 100644
--- a/libquadmath/Makefile.am
+++ b/libquadmath/Makefile.am
@@ -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
diff --git a/libquadmath/Makefile.in b/libquadmath/Makefile.in
index a241b131da3..2fdebebbd7e 100644
--- a/libquadmath/Makefile.in
+++ b/libquadmath/Makefile.in
@@ -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@
diff --git a/libquadmath/libquadmath.texi b/libquadmath/libquadmath.texi
index aba777b4fcd..50b9e62e495 100644
--- a/libquadmath/libquadmath.texi
+++ b/libquadmath/libquadmath.texi
@@ -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
diff --git a/libquadmath/math/atan2q.c b/libquadmath/math/atan2q.c
index 9d24dccb54e..fbe64d62b95 100644
--- a/libquadmath/math/atan2q.c
+++ b/libquadmath/math/atan2q.c
@@ -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(+,+) */
diff --git a/libquadmath/math/cacoshq.c b/libquadmath/math/cacoshq.c
new file mode 100644
index 00000000000..8acc570de76
--- /dev/null
+++ b/libquadmath/math/cacoshq.c
@@ -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
index 00000000000..3c257b029bf
--- /dev/null
+++ b/libquadmath/math/cacosq.c
@@ -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
index 00000000000..ffa45fa81d9
--- /dev/null
+++ b/libquadmath/math/casinhq.c
@@ -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
index 00000000000..122ef5d85ae
--- /dev/null
+++ b/libquadmath/math/casinq.c
@@ -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
index 00000000000..6a86e2d0202
--- /dev/null
+++ b/libquadmath/math/catanhq.c
@@ -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
index 00000000000..a9c92579734
--- /dev/null
+++ b/libquadmath/math/catanq.c
@@ -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;
+}
diff --git a/libquadmath/math/cosq.c b/libquadmath/math/cosq.c
index 16955511e04..dc321a27d17 100644
--- a/libquadmath/math/cosq.c
+++ b/libquadmath/math/cosq.c
@@ -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. */
diff --git a/libquadmath/math/hypotq.c b/libquadmath/math/hypotq.c
index e4c2d1bc214..2df317f3681 100644
--- a/libquadmath/math/hypotq.c
+++ b/libquadmath/math/hypotq.c
@@ -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;
diff --git a/libquadmath/quadmath-imp.h b/libquadmath/quadmath-imp.h
index ac9359b6626..5404c9eef99 100644
--- a/libquadmath/quadmath-imp.h
+++ b/libquadmath/quadmath-imp.h
@@ -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
diff --git a/libquadmath/quadmath.h b/libquadmath/quadmath.h
index 5fe9549d376..bc413375560 100644
--- a/libquadmath/quadmath.h
+++ b/libquadmath/quadmath.h
@@ -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
diff --git a/libquadmath/quadmath.map b/libquadmath/quadmath.map
index f70cda120af..2a6628751d7 100644
--- a/libquadmath/quadmath.map
+++ b/libquadmath/quadmath.map
@@ -7,6 +7,12 @@ QUADMATH_1.0 {
atanq;
atanhq;
atan2q;
+ cacoshq;
+ cacosq;
+ casinhq;
+ casinq;
+ catanhq;
+ catanq;
cbrtq;
ceilq;
copysignq;
diff --git a/libquadmath/quadmath_weak.h b/libquadmath/quadmath_weak.h
index 05b04389376..d2c3d86d4a2 100644
--- a/libquadmath/quadmath_weak.h
+++ b/libquadmath/quadmath_weak.h
@@ -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)