This is the mail archive of the glibc-cvs@sourceware.org mailing list for the glibc 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]

GNU C Library master sources branch master updated. glibc-2.24-85-gd5602ce


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU C Library master sources".

The branch, master has been updated
       via  d5602cebf1ff25ef34298a52209283879609ec16 (commit)
       via  f6d3a72eca7558e3c52cecc8484665399eeea626 (commit)
       via  c50eee19c447d3f2c182dc3a22f2b01a053dca41 (commit)
       via  ffb84f5e197aaa9d46a35df84689c75d689d73cb (commit)
      from  a6f20b6763c972c05c497c6028d412d6d1717971 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
http://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=d5602cebf1ff25ef34298a52209283879609ec16

commit d5602cebf1ff25ef34298a52209283879609ec16
Author: Paul E. Murphy <murphyp@linux.vnet.ibm.com>
Date:   Tue Jun 28 11:06:42 2016 -0500

    Convert _Complex tangent functions to generated code
    
    This converts s_c{,a}tan{,h}{f,,l} into a single
    templated file c{,a}tan{,h}_template.c with the
    exception of alpha.

diff --git a/ChangeLog b/ChangeLog
index 4ae38e3..75840ba 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,41 @@
 2016-08-19  Paul E. Murphy  <murphyp@linux.vnet.ibm.com>
 
+	* math/Makefile (libm-gen-calls): Add
+	catan, catanh, ctan, ctanh.
+	(libm-calls): Remove the above.
+
+	* math/s_catan_template.c: Update using type-generic macros.
+	* math/s_catanh_template.c: Likewise.
+	* math/s_ctan_template.c: Likewise.
+	* math/s_ctanh_template.c: Likewise.
+
+	* math/s_catanf.c: Removed.
+	* math/s_catan.c: Removed.
+	* math/s_catanl.c: Removed.
+	* math/s_catanhf.c: Removed.
+	* math/s_catanh.c: Removed.
+	* math/s_catanhl.c: Removed.
+	* math/s_ctanf.c: Removed.
+	* math/s_ctan.c: Removed.
+	* math/s_ctanl.c: Removed.
+	* math/s_ctanhf.c: Removed.
+	* math/s_ctanh.c: Removed.
+	* math/s_ctanhl.c: Removed.
+
+	* sysdeps/ieee754/ldbl-opt/s_catanhl.c: Removed.
+	* sysdeps/ieee754/ldbl-opt/s_catanl.c: Removed.
+	* sysdeps/ieee754/ldbl-opt/s_ctan.c: Removed.
+	* sysdeps/ieee754/ldbl-opt/s_ctanh.c: Removed.
+	* sysdeps/ieee754/ldbl-opt/s_ctanhl.c: Removed.
+	* sysdeps/ieee754/ldbl-opt/s_ctanl.c: Removed.
+
+	* sysdeps/alpha/fpu/s_catanf.c: Update to use template file.
+	* sysdeps/alpha/fpu/s_catanhf.c: Likewise.
+	* sysdeps/alpha/fpu/s_ctanf.c: Likewise.
+	* sysdeps/alpha/fpu/s_ctanhf.c: Likewise.
+
+2016-08-19  Paul E. Murphy  <murphyp@linux.vnet.ibm.com>
+
 	* s_catan_template.c: Copy of s_catan.c.
 	* s_catanh_template.c: Copy of s_catanh.c.
 	* s_ctan_template.c: Copy of s_ctan.c.
diff --git a/math/Makefile b/math/Makefile
index 8873a9e..03cbd1d 100644
--- a/math/Makefile
+++ b/math/Makefile
@@ -47,7 +47,8 @@ libm-support = s_lib_version s_matherr s_signgam			\
 # <func>_template.c and the appropriate math-type-macros-<TYPE>.h.
 gen-libm-calls = cargF conjF cimagF crealF cabsF s_cacosF		  \
 	         s_cacoshF s_ccosF s_ccoshF s_casinF s_csinF s_casinhF	  \
-		 k_casinhF s_csinhF
+		 k_casinhF s_csinhF k_casinhF s_csinhF s_catanhF s_catanF \
+		 s_ctanF s_ctanhF
 
 libm-calls =								  \
 	e_acosF e_acoshF e_asinF e_atan2F e_atanhF e_coshF e_expF e_fmodF \
@@ -66,8 +67,7 @@ libm-calls =								  \
 	s_fpclassifyF s_fmaxF s_fminF s_fdimF s_nanF s_truncF		  \
 	s_remquoF e_log2F e_exp2F s_roundF s_nearbyintF s_sincosF	  \
 	s_cexpF s_clogF							  \
-	s_catanF s_ctanF s_ctanhF					  \
-	s_catanhF s_csqrtF s_cpowF s_cprojF s_clog10F			  \
+	s_csqrtF s_cpowF s_cprojF s_clog10F				  \
 	s_fmaF s_lrintF s_llrintF s_lroundF s_llroundF e_exp10F w_log2F	  \
 	s_issignalingF $(calls:s_%=m_%) x2y2m1F				  \
 	gamma_productF lgamma_negF lgamma_productF			  \
diff --git a/math/s_catan.c b/math/s_catan.c
deleted file mode 100644
index 5ab4c0d..0000000
--- a/math/s_catan.c
+++ /dev/null
@@ -1,143 +0,0 @@
-/* Return arc tangent of complex double value.
-   Copyright (C) 1997-2016 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, see
-   <http://www.gnu.org/licenses/>.  */
-
-#include <complex.h>
-#include <math.h>
-#include <math_private.h>
-#include <float.h>
-
-__complex__ double
-__catan (__complex__ double x)
-{
-  __complex__ double res;
-  int rcls = fpclassify (__real__ x);
-  int icls = fpclassify (__imag__ x);
-
-  if (__glibc_unlikely (rcls <= FP_INFINITE || icls <= FP_INFINITE))
-    {
-      if (rcls == FP_INFINITE)
-	{
-	  __real__ res = __copysign (M_PI_2, __real__ x);
-	  __imag__ res = __copysign (0.0, __imag__ x);
-	}
-      else if (icls == FP_INFINITE)
-	{
-	  if (rcls >= FP_ZERO)
-	    __real__ res = __copysign (M_PI_2, __real__ x);
-	  else
-	    __real__ res = __nan ("");
-	  __imag__ res = __copysign (0.0, __imag__ x);
-	}
-      else if (icls == FP_ZERO || icls == FP_INFINITE)
-	{
-	  __real__ res = __nan ("");
-	  __imag__ res = __copysign (0.0, __imag__ x);
-	}
-      else
-	{
-	  __real__ res = __nan ("");
-	  __imag__ res = __nan ("");
-	}
-    }
-  else if (__glibc_unlikely (rcls == FP_ZERO && icls == FP_ZERO))
-    {
-      res = x;
-    }
-  else
-    {
-      if (fabs (__real__ x) >= 16.0 / DBL_EPSILON
-	  || fabs (__imag__ x) >= 16.0 / DBL_EPSILON)
-	{
-	  __real__ res = __copysign (M_PI_2, __real__ x);
-	  if (fabs (__real__ x) <= 1.0)
-	    __imag__ res = 1.0 / __imag__ x;
-	  else if (fabs (__imag__ x) <= 1.0)
-	    __imag__ res = __imag__ x / __real__ x / __real__ x;
-	  else
-	    {
-	      double h = __ieee754_hypot (__real__ x / 2.0, __imag__ x / 2.0);
-	      __imag__ res = __imag__ x / h / h / 4.0;
-	    }
-	}
-      else
-	{
-	  double den, absx, absy;
-
-	  absx = fabs (__real__ x);
-	  absy = fabs (__imag__ x);
-	  if (absx < absy)
-	    {
-	      double t = absx;
-	      absx = absy;
-	      absy = t;
-	    }
-
-	  if (absy < DBL_EPSILON / 2.0)
-	    {
-	      den = (1.0 - absx) * (1.0 + absx);
-	      if (den == -0.0)
-		den = 0.0;
-	    }
-	  else if (absx >= 1.0)
-	    den = (1.0 - absx) * (1.0 + absx) - absy * absy;
-	  else if (absx >= 0.75 || absy >= 0.5)
-	    den = -__x2y2m1 (absx, absy);
-	  else
-	    den = (1.0 - absx) * (1.0 + absx) - absy * absy;
-
-	  __real__ res = 0.5 * __ieee754_atan2 (2.0 * __real__ x, den);
-
-	  if (fabs (__imag__ x) == 1.0
-	      && fabs (__real__ x) < DBL_EPSILON * DBL_EPSILON)
-	    __imag__ res = (__copysign (0.5, __imag__ x)
-			    * (M_LN2 - __ieee754_log (fabs (__real__ x))));
-	  else
-	    {
-	      double r2 = 0.0, num, f;
-
-	      if (fabs (__real__ x) >= DBL_EPSILON * DBL_EPSILON)
-		r2 = __real__ x * __real__ x;
-
-	      num = __imag__ x + 1.0;
-	      num = r2 + num * num;
-
-	      den = __imag__ x - 1.0;
-	      den = r2 + den * den;
-
-	      f = num / den;
-	      if (f < 0.5)
-		__imag__ res = 0.25 * __ieee754_log (f);
-	      else
-		{
-		  num = 4.0 * __imag__ x;
-		  __imag__ res = 0.25 * __log1p (num / den);
-		}
-	    }
-	}
-
-      math_check_force_underflow_complex (res);
-    }
-
-  return res;
-}
-weak_alias (__catan, catan)
-#ifdef NO_LONG_DOUBLE
-strong_alias (__catan, __catanl)
-weak_alias (__catan, catanl)
-#endif
diff --git a/math/s_catan_template.c b/math/s_catan_template.c
index 5ab4c0d..d8db96d 100644
--- a/math/s_catan_template.c
+++ b/math/s_catan_template.c
@@ -1,4 +1,4 @@
-/* Return arc tangent of complex double value.
+/* Return arc tangent of complex float type.
    Copyright (C) 1997-2016 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
@@ -22,10 +22,10 @@
 #include <math_private.h>
 #include <float.h>
 
-__complex__ double
-__catan (__complex__ double x)
+CFLOAT
+M_DECL_FUNC (__catan) (CFLOAT x)
 {
-  __complex__ double res;
+  CFLOAT res;
   int rcls = fpclassify (__real__ x);
   int icls = fpclassify (__imag__ x);
 
@@ -33,26 +33,26 @@ __catan (__complex__ double x)
     {
       if (rcls == FP_INFINITE)
 	{
-	  __real__ res = __copysign (M_PI_2, __real__ x);
-	  __imag__ res = __copysign (0.0, __imag__ x);
+	  __real__ res = M_COPYSIGN (M_MLIT (M_PI_2), __real__ x);
+	  __imag__ res = M_COPYSIGN (0, __imag__ x);
 	}
       else if (icls == FP_INFINITE)
 	{
 	  if (rcls >= FP_ZERO)
-	    __real__ res = __copysign (M_PI_2, __real__ x);
+	    __real__ res = M_COPYSIGN (M_MLIT (M_PI_2), __real__ x);
 	  else
-	    __real__ res = __nan ("");
-	  __imag__ res = __copysign (0.0, __imag__ x);
+	    __real__ res = M_NAN;
+	  __imag__ res = M_COPYSIGN (0, __imag__ x);
 	}
       else if (icls == FP_ZERO || icls == FP_INFINITE)
 	{
-	  __real__ res = __nan ("");
-	  __imag__ res = __copysign (0.0, __imag__ x);
+	  __real__ res = M_NAN;
+	  __imag__ res = M_COPYSIGN (0, __imag__ x);
 	}
       else
 	{
-	  __real__ res = __nan ("");
-	  __imag__ res = __nan ("");
+	  __real__ res = M_NAN;
+	  __imag__ res = M_NAN;
 	}
     }
   else if (__glibc_unlikely (rcls == FP_ZERO && icls == FP_ZERO))
@@ -61,72 +61,73 @@ __catan (__complex__ double x)
     }
   else
     {
-      if (fabs (__real__ x) >= 16.0 / DBL_EPSILON
-	  || fabs (__imag__ x) >= 16.0 / DBL_EPSILON)
+      if (M_FABS (__real__ x) >= 16 / M_EPSILON
+	  || M_FABS (__imag__ x) >= 16 / M_EPSILON)
 	{
-	  __real__ res = __copysign (M_PI_2, __real__ x);
-	  if (fabs (__real__ x) <= 1.0)
-	    __imag__ res = 1.0 / __imag__ x;
-	  else if (fabs (__imag__ x) <= 1.0)
+	  __real__ res = M_COPYSIGN (M_MLIT (M_PI_2), __real__ x);
+	  if (M_FABS (__real__ x) <= 1)
+	    __imag__ res = 1 / __imag__ x;
+	  else if (M_FABS (__imag__ x) <= 1)
 	    __imag__ res = __imag__ x / __real__ x / __real__ x;
 	  else
 	    {
-	      double h = __ieee754_hypot (__real__ x / 2.0, __imag__ x / 2.0);
-	      __imag__ res = __imag__ x / h / h / 4.0;
+	      FLOAT h = M_HYPOT (__real__ x / 2, __imag__ x / 2);
+	      __imag__ res = __imag__ x / h / h / 4;
 	    }
 	}
       else
 	{
-	  double den, absx, absy;
+	  FLOAT den, absx, absy;
 
-	  absx = fabs (__real__ x);
-	  absy = fabs (__imag__ x);
+	  absx = M_FABS (__real__ x);
+	  absy = M_FABS (__imag__ x);
 	  if (absx < absy)
 	    {
-	      double t = absx;
+	      FLOAT t = absx;
 	      absx = absy;
 	      absy = t;
 	    }
 
-	  if (absy < DBL_EPSILON / 2.0)
+	  if (absy < M_EPSILON / 2)
 	    {
-	      den = (1.0 - absx) * (1.0 + absx);
-	      if (den == -0.0)
-		den = 0.0;
+	      den = (1 - absx) * (1 + absx);
+	      if (den == 0)
+		den = 0;
 	    }
-	  else if (absx >= 1.0)
-	    den = (1.0 - absx) * (1.0 + absx) - absy * absy;
-	  else if (absx >= 0.75 || absy >= 0.5)
-	    den = -__x2y2m1 (absx, absy);
+	  else if (absx >= 1)
+	    den = (1 - absx) * (1 + absx) - absy * absy;
+	  else if (absx >= M_LIT (0.75) || absy >= M_LIT (0.5))
+	    den = -M_SUF (__x2y2m1) (absx, absy);
 	  else
-	    den = (1.0 - absx) * (1.0 + absx) - absy * absy;
+	    den = (1 - absx) * (1 + absx) - absy * absy;
 
-	  __real__ res = 0.5 * __ieee754_atan2 (2.0 * __real__ x, den);
+	  __real__ res = M_LIT (0.5) * M_ATAN2 (2 * __real__ x, den);
 
-	  if (fabs (__imag__ x) == 1.0
-	      && fabs (__real__ x) < DBL_EPSILON * DBL_EPSILON)
-	    __imag__ res = (__copysign (0.5, __imag__ x)
-			    * (M_LN2 - __ieee754_log (fabs (__real__ x))));
+	  if (M_FABS (__imag__ x) == 1
+	      && M_FABS (__real__ x) < M_EPSILON * M_EPSILON)
+	    __imag__ res = (M_COPYSIGN (M_LIT (0.5), __imag__ x)
+			    * ((FLOAT) M_MLIT (M_LN2)
+			       - M_LOG (M_FABS (__real__ x))));
 	  else
 	    {
-	      double r2 = 0.0, num, f;
+	      FLOAT r2 = 0, num, f;
 
-	      if (fabs (__real__ x) >= DBL_EPSILON * DBL_EPSILON)
+	      if (M_FABS (__real__ x) >= M_EPSILON * M_EPSILON)
 		r2 = __real__ x * __real__ x;
 
-	      num = __imag__ x + 1.0;
+	      num = __imag__ x + 1;
 	      num = r2 + num * num;
 
-	      den = __imag__ x - 1.0;
+	      den = __imag__ x - 1;
 	      den = r2 + den * den;
 
 	      f = num / den;
-	      if (f < 0.5)
-		__imag__ res = 0.25 * __ieee754_log (f);
+	      if (f < M_LIT (0.5))
+		__imag__ res = M_LIT (0.25) * M_LOG (f);
 	      else
 		{
-		  num = 4.0 * __imag__ x;
-		  __imag__ res = 0.25 * __log1p (num / den);
+		  num = 4 * __imag__ x;
+		  __imag__ res = M_LIT (0.25) * M_LOG1P (num / den);
 		}
 	    }
 	}
@@ -136,8 +137,9 @@ __catan (__complex__ double x)
 
   return res;
 }
-weak_alias (__catan, catan)
-#ifdef NO_LONG_DOUBLE
-strong_alias (__catan, __catanl)
-weak_alias (__catan, catanl)
+
+declare_mgen_alias (__catan, catan)
+
+#if M_LIBM_NEED_COMPAT (catan)
+declare_mgen_libm_compat (__catan, catan)
 #endif
diff --git a/math/s_catanf.c b/math/s_catanf.c
deleted file mode 100644
index 63e6b6e..0000000
--- a/math/s_catanf.c
+++ /dev/null
@@ -1,143 +0,0 @@
-/* Return arc tangent of complex float value.
-   Copyright (C) 1997-2016 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, see
-   <http://www.gnu.org/licenses/>.  */
-
-#include <complex.h>
-#include <math.h>
-#include <math_private.h>
-#include <float.h>
-
-__complex__ float
-__catanf (__complex__ float x)
-{
-  __complex__ float res;
-  int rcls = fpclassify (__real__ x);
-  int icls = fpclassify (__imag__ x);
-
-  if (__glibc_unlikely (rcls <= FP_INFINITE || icls <= FP_INFINITE))
-    {
-      if (rcls == FP_INFINITE)
-	{
-	  __real__ res = __copysignf (M_PI_2, __real__ x);
-	  __imag__ res = __copysignf (0.0, __imag__ x);
-	}
-      else if (icls == FP_INFINITE)
-	{
-	  if (rcls >= FP_ZERO)
-	    __real__ res = __copysignf (M_PI_2, __real__ x);
-	  else
-	    __real__ res = __nanf ("");
-	  __imag__ res = __copysignf (0.0, __imag__ x);
-	}
-      else if (icls == FP_ZERO || icls == FP_INFINITE)
-	{
-	  __real__ res = __nanf ("");
-	  __imag__ res = __copysignf (0.0, __imag__ x);
-	}
-      else
-	{
-	  __real__ res = __nanf ("");
-	  __imag__ res = __nanf ("");
-	}
-    }
-  else if (__glibc_unlikely (rcls == FP_ZERO && icls == FP_ZERO))
-    {
-      res = x;
-    }
-  else
-    {
-      if (fabsf (__real__ x) >= 16.0f / FLT_EPSILON
-	  || fabsf (__imag__ x) >= 16.0f / FLT_EPSILON)
-	{
-	  __real__ res = __copysignf ((float) M_PI_2, __real__ x);
-	  if (fabsf (__real__ x) <= 1.0f)
-	    __imag__ res = 1.0f / __imag__ x;
-	  else if (fabsf (__imag__ x) <= 1.0f)
-	    __imag__ res = __imag__ x / __real__ x / __real__ x;
-	  else
-	    {
-	      float h = __ieee754_hypotf (__real__ x / 2.0f,
-					  __imag__ x / 2.0f);
-	      __imag__ res = __imag__ x / h / h / 4.0f;
-	    }
-	}
-      else
-	{
-	  float den, absx, absy;
-
-	  absx = fabsf (__real__ x);
-	  absy = fabsf (__imag__ x);
-	  if (absx < absy)
-	    {
-	      float t = absx;
-	      absx = absy;
-	      absy = t;
-	    }
-
-	  if (absy < FLT_EPSILON / 2.0f)
-	    {
-	      den = (1.0f - absx) * (1.0f + absx);
-	      if (den == -0.0f)
-		den = 0.0f;
-	    }
-	  else if (absx >= 1.0f)
-	    den = (1.0f - absx) * (1.0f + absx) - absy * absy;
-	  else if (absx >= 0.75f || absy >= 0.5f)
-	    den = -__x2y2m1f (absx, absy);
-	  else
-	    den = (1.0f - absx) * (1.0f + absx) - absy * absy;
-
-	  __real__ res = 0.5f * __ieee754_atan2f (2.0f * __real__ x, den);
-
-	  if (fabsf (__imag__ x) == 1.0f
-	      && fabsf (__real__ x) < FLT_EPSILON * FLT_EPSILON)
-	    __imag__ res = (__copysignf (0.5f, __imag__ x)
-			    * ((float) M_LN2
-			       - __ieee754_logf (fabsf (__real__ x))));
-	  else
-	    {
-	      float r2 = 0.0f, num, f;
-
-	      if (fabsf (__real__ x) >= FLT_EPSILON * FLT_EPSILON)
-		r2 = __real__ x * __real__ x;
-
-	      num = __imag__ x + 1.0f;
-	      num = r2 + num * num;
-
-	      den = __imag__ x - 1.0f;
-	      den = r2 + den * den;
-
-	      f = num / den;
-	      if (f < 0.5f)
-		__imag__ res = 0.25f * __ieee754_logf (f);
-	      else
-		{
-		  num = 4.0f * __imag__ x;
-		  __imag__ res = 0.25f * __log1pf (num / den);
-		}
-	    }
-	}
-
-      math_check_force_underflow_complex (res);
-    }
-
-  return res;
-}
-#ifndef __catanf
-weak_alias (__catanf, catanf)
-#endif
diff --git a/math/s_catanh.c b/math/s_catanh.c
deleted file mode 100644
index 11ea062..0000000
--- a/math/s_catanh.c
+++ /dev/null
@@ -1,137 +0,0 @@
-/* Return arc hyperbole tangent for double value.
-   Copyright (C) 1997-2016 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, see
-   <http://www.gnu.org/licenses/>.  */
-
-#include <complex.h>
-#include <math.h>
-#include <math_private.h>
-#include <float.h>
-
-__complex__ double
-__catanh (__complex__ double x)
-{
-  __complex__ double res;
-  int rcls = fpclassify (__real__ x);
-  int icls = fpclassify (__imag__ x);
-
-  if (__glibc_unlikely (rcls <= FP_INFINITE || icls <= FP_INFINITE))
-    {
-      if (icls == FP_INFINITE)
-	{
-	  __real__ res = __copysign (0.0, __real__ x);
-	  __imag__ res = __copysign (M_PI_2, __imag__ x);
-	}
-      else if (rcls == FP_INFINITE || rcls == FP_ZERO)
-	{
-	  __real__ res = __copysign (0.0, __real__ x);
-	  if (icls >= FP_ZERO)
-	    __imag__ res = __copysign (M_PI_2, __imag__ x);
-	  else
-	    __imag__ res = __nan ("");
-	}
-      else
-	{
-	  __real__ res = __nan ("");
-	  __imag__ res = __nan ("");
-	}
-    }
-  else if (__glibc_unlikely (rcls == FP_ZERO && icls == FP_ZERO))
-    {
-      res = x;
-    }
-  else
-    {
-      if (fabs (__real__ x) >= 16.0 / DBL_EPSILON
-	  || fabs (__imag__ x) >= 16.0 / DBL_EPSILON)
-	{
-	  __imag__ res = __copysign (M_PI_2, __imag__ x);
-	  if (fabs (__imag__ x) <= 1.0)
-	    __real__ res = 1.0 / __real__ x;
-	  else if (fabs (__real__ x) <= 1.0)
-	    __real__ res = __real__ x / __imag__ x / __imag__ x;
-	  else
-	    {
-	      double h = __ieee754_hypot (__real__ x / 2.0, __imag__ x / 2.0);
-	      __real__ res = __real__ x / h / h / 4.0;
-	    }
-	}
-      else
-	{
-	  if (fabs (__real__ x) == 1.0
-	      && fabs (__imag__ x) < DBL_EPSILON * DBL_EPSILON)
-	    __real__ res = (__copysign (0.5, __real__ x)
-			    * (M_LN2 - __ieee754_log (fabs (__imag__ x))));
-	  else
-	    {
-	      double i2 = 0.0;
-	      if (fabs (__imag__ x) >= DBL_EPSILON * DBL_EPSILON)
-		i2 = __imag__ x * __imag__ x;
-
-	      double num = 1.0 + __real__ x;
-	      num = i2 + num * num;
-
-	      double den = 1.0 - __real__ x;
-	      den = i2 + den * den;
-
-	      double f = num / den;
-	      if (f < 0.5)
-		__real__ res = 0.25 * __ieee754_log (f);
-	      else
-		{
-		  num = 4.0 * __real__ x;
-		  __real__ res = 0.25 * __log1p (num / den);
-		}
-	    }
-
-	  double absx, absy, den;
-
-	  absx = fabs (__real__ x);
-	  absy = fabs (__imag__ x);
-	  if (absx < absy)
-	    {
-	      double t = absx;
-	      absx = absy;
-	      absy = t;
-	    }
-
-	  if (absy < DBL_EPSILON / 2.0)
-	    {
-	      den = (1.0 - absx) * (1.0 + absx);
-	      if (den == -0.0)
-		den = 0.0;
-	    }
-	  else if (absx >= 1.0)
-	    den = (1.0 - absx) * (1.0 + absx) - absy * absy;
-	  else if (absx >= 0.75 || absy >= 0.5)
-	    den = -__x2y2m1 (absx, absy);
-	  else
-	    den = (1.0 - absx) * (1.0 + absx) - absy * absy;
-
-	  __imag__ res = 0.5 * __ieee754_atan2 (2.0 * __imag__ x, den);
-	}
-
-      math_check_force_underflow_complex (res);
-    }
-
-  return res;
-}
-weak_alias (__catanh, catanh)
-#ifdef NO_LONG_DOUBLE
-strong_alias (__catanh, __catanhl)
-weak_alias (__catanh, catanhl)
-#endif
diff --git a/math/s_catanh_template.c b/math/s_catanh_template.c
index 11ea062..0669c4c 100644
--- a/math/s_catanh_template.c
+++ b/math/s_catanh_template.c
@@ -1,4 +1,4 @@
-/* Return arc hyperbole tangent for double value.
+/* Return arc hyperbolic tangent for a complex float type.
    Copyright (C) 1997-2016 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
@@ -22,10 +22,10 @@
 #include <math_private.h>
 #include <float.h>
 
-__complex__ double
-__catanh (__complex__ double x)
+CFLOAT
+M_DECL_FUNC (__catanh) (CFLOAT x)
 {
-  __complex__ double res;
+  CFLOAT res;
   int rcls = fpclassify (__real__ x);
   int icls = fpclassify (__imag__ x);
 
@@ -33,21 +33,21 @@ __catanh (__complex__ double x)
     {
       if (icls == FP_INFINITE)
 	{
-	  __real__ res = __copysign (0.0, __real__ x);
-	  __imag__ res = __copysign (M_PI_2, __imag__ x);
+	  __real__ res = M_COPYSIGN (0, __real__ x);
+	  __imag__ res = M_COPYSIGN (M_MLIT (M_PI_2), __imag__ x);
 	}
       else if (rcls == FP_INFINITE || rcls == FP_ZERO)
 	{
-	  __real__ res = __copysign (0.0, __real__ x);
+	  __real__ res = M_COPYSIGN (0, __real__ x);
 	  if (icls >= FP_ZERO)
-	    __imag__ res = __copysign (M_PI_2, __imag__ x);
+	    __imag__ res = M_COPYSIGN (M_MLIT (M_PI_2), __imag__ x);
 	  else
-	    __imag__ res = __nan ("");
+	    __imag__ res = M_NAN;
 	}
       else
 	{
-	  __real__ res = __nan ("");
-	  __imag__ res = __nan ("");
+	  __real__ res = M_NAN;
+	  __imag__ res = M_NAN;
 	}
     }
   else if (__glibc_unlikely (rcls == FP_ZERO && icls == FP_ZERO))
@@ -56,73 +56,74 @@ __catanh (__complex__ double x)
     }
   else
     {
-      if (fabs (__real__ x) >= 16.0 / DBL_EPSILON
-	  || fabs (__imag__ x) >= 16.0 / DBL_EPSILON)
+      if (M_FABS (__real__ x) >= 16 / M_EPSILON
+	  || M_FABS (__imag__ x) >= 16 / M_EPSILON)
 	{
-	  __imag__ res = __copysign (M_PI_2, __imag__ x);
-	  if (fabs (__imag__ x) <= 1.0)
-	    __real__ res = 1.0 / __real__ x;
-	  else if (fabs (__real__ x) <= 1.0)
+	  __imag__ res = M_COPYSIGN (M_MLIT (M_PI_2), __imag__ x);
+	  if (M_FABS (__imag__ x) <= 1)
+	    __real__ res = 1 / __real__ x;
+	  else if (M_FABS (__real__ x) <= 1)
 	    __real__ res = __real__ x / __imag__ x / __imag__ x;
 	  else
 	    {
-	      double h = __ieee754_hypot (__real__ x / 2.0, __imag__ x / 2.0);
-	      __real__ res = __real__ x / h / h / 4.0;
+	      FLOAT h = M_HYPOT (__real__ x / 2, __imag__ x / 2);
+	      __real__ res = __real__ x / h / h / 4;
 	    }
 	}
       else
 	{
-	  if (fabs (__real__ x) == 1.0
-	      && fabs (__imag__ x) < DBL_EPSILON * DBL_EPSILON)
-	    __real__ res = (__copysign (0.5, __real__ x)
-			    * (M_LN2 - __ieee754_log (fabs (__imag__ x))));
+	  if (M_FABS (__real__ x) == 1
+	      && M_FABS (__imag__ x) < M_EPSILON * M_EPSILON)
+	    __real__ res = (M_COPYSIGN (M_LIT (0.5), __real__ x)
+			    * ((FLOAT) M_MLIT (M_LN2)
+			       - M_LOG (M_FABS (__imag__ x))));
 	  else
 	    {
-	      double i2 = 0.0;
-	      if (fabs (__imag__ x) >= DBL_EPSILON * DBL_EPSILON)
+	      FLOAT i2 = 0;
+	      if (M_FABS (__imag__ x) >= M_EPSILON * M_EPSILON)
 		i2 = __imag__ x * __imag__ x;
 
-	      double num = 1.0 + __real__ x;
+	      FLOAT num = 1 + __real__ x;
 	      num = i2 + num * num;
 
-	      double den = 1.0 - __real__ x;
+	      FLOAT den = 1 - __real__ x;
 	      den = i2 + den * den;
 
-	      double f = num / den;
-	      if (f < 0.5)
-		__real__ res = 0.25 * __ieee754_log (f);
+	      FLOAT f = num / den;
+	      if (f < M_LIT (0.5))
+		__real__ res = M_LIT (0.25) * M_LOG (f);
 	      else
 		{
-		  num = 4.0 * __real__ x;
-		  __real__ res = 0.25 * __log1p (num / den);
+		  num = 4 * __real__ x;
+		  __real__ res = M_LIT (0.25) * M_LOG1P (num / den);
 		}
 	    }
 
-	  double absx, absy, den;
+	  FLOAT absx, absy, den;
 
-	  absx = fabs (__real__ x);
-	  absy = fabs (__imag__ x);
+	  absx = M_FABS (__real__ x);
+	  absy = M_FABS (__imag__ x);
 	  if (absx < absy)
 	    {
-	      double t = absx;
+	      FLOAT t = absx;
 	      absx = absy;
 	      absy = t;
 	    }
 
-	  if (absy < DBL_EPSILON / 2.0)
+	  if (absy < M_EPSILON / 2)
 	    {
-	      den = (1.0 - absx) * (1.0 + absx);
-	      if (den == -0.0)
-		den = 0.0;
+	      den = (1 - absx) * (1 + absx);
+	      if (den == 0)
+		den = 0;
 	    }
-	  else if (absx >= 1.0)
-	    den = (1.0 - absx) * (1.0 + absx) - absy * absy;
-	  else if (absx >= 0.75 || absy >= 0.5)
-	    den = -__x2y2m1 (absx, absy);
+	  else if (absx >= 1)
+	    den = (1 - absx) * (1 + absx) - absy * absy;
+	  else if (absx >= M_LIT (0.75) || absy >= M_LIT (0.5))
+	    den = -M_SUF (__x2y2m1) (absx, absy);
 	  else
-	    den = (1.0 - absx) * (1.0 + absx) - absy * absy;
+	    den = (1 - absx) * (1 + absx) - absy * absy;
 
-	  __imag__ res = 0.5 * __ieee754_atan2 (2.0 * __imag__ x, den);
+	  __imag__ res = M_LIT (0.5) * M_ATAN2 (2 * __imag__ x, den);
 	}
 
       math_check_force_underflow_complex (res);
@@ -130,8 +131,9 @@ __catanh (__complex__ double x)
 
   return res;
 }
-weak_alias (__catanh, catanh)
-#ifdef NO_LONG_DOUBLE
-strong_alias (__catanh, __catanhl)
-weak_alias (__catanh, catanhl)
+
+declare_mgen_alias (__catanh, catanh)
+
+#if M_LIBM_NEED_COMPAT (catanh)
+declare_mgen_libm_compat (__catanh, catanh)
 #endif
diff --git a/math/s_catanhf.c b/math/s_catanhf.c
deleted file mode 100644
index fe43a51..0000000
--- a/math/s_catanhf.c
+++ /dev/null
@@ -1,137 +0,0 @@
-/* Return arc hyperbole tangent for float value.
-   Copyright (C) 1997-2016 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, see
-   <http://www.gnu.org/licenses/>.  */
-
-#include <complex.h>
-#include <math.h>
-#include <math_private.h>
-#include <float.h>
-
-__complex__ float
-__catanhf (__complex__ float x)
-{
-  __complex__ float res;
-  int rcls = fpclassify (__real__ x);
-  int icls = fpclassify (__imag__ x);
-
-  if (__glibc_unlikely (rcls <= FP_INFINITE || icls <= FP_INFINITE))
-    {
-      if (icls == FP_INFINITE)
-	{
-	  __real__ res = __copysignf (0.0, __real__ x);
-	  __imag__ res = __copysignf (M_PI_2, __imag__ x);
-	}
-      else if (rcls == FP_INFINITE || rcls == FP_ZERO)
-	{
-	  __real__ res = __copysignf (0.0, __real__ x);
-	  if (icls >= FP_ZERO)
-	    __imag__ res = __copysignf (M_PI_2, __imag__ x);
-	  else
-	    __imag__ res = __nanf ("");
-	}
-      else
-	{
-	  __real__ res = __nanf ("");
-	  __imag__ res = __nanf ("");
-	}
-    }
-  else if (__glibc_unlikely (rcls == FP_ZERO && icls == FP_ZERO))
-    {
-      res = x;
-    }
-  else
-    {
-      if (fabsf (__real__ x) >= 16.0f / FLT_EPSILON
-	  || fabsf (__imag__ x) >= 16.0f / FLT_EPSILON)
-	{
-	  __imag__ res = __copysignf ((float) M_PI_2, __imag__ x);
-	  if (fabsf (__imag__ x) <= 1.0f)
-	    __real__ res = 1.0f / __real__ x;
-	  else if (fabsf (__real__ x) <= 1.0f)
-	    __real__ res = __real__ x / __imag__ x / __imag__ x;
-	  else
-	    {
-	      float h = __ieee754_hypotf (__real__ x / 2.0f,
-					  __imag__ x / 2.0f);
-	      __real__ res = __real__ x / h / h / 4.0f;
-	    }
-	}
-      else
-	{
-	  if (fabsf (__real__ x) == 1.0f
-	      && fabsf (__imag__ x) < FLT_EPSILON * FLT_EPSILON)
-	    __real__ res = (__copysignf (0.5f, __real__ x)
-			    * ((float) M_LN2
-			       - __ieee754_logf (fabsf (__imag__ x))));
-	  else
-	    {
-	      float i2 = 0.0f;
-	      if (fabsf (__imag__ x) >= FLT_EPSILON * FLT_EPSILON)
-		i2 = __imag__ x * __imag__ x;
-
-	      float num = 1.0f + __real__ x;
-	      num = i2 + num * num;
-
-	      float den = 1.0f - __real__ x;
-	      den = i2 + den * den;
-
-	      float f = num / den;
-	      if (f < 0.5f)
-		__real__ res = 0.25f * __ieee754_logf (f);
-	      else
-		{
-		  num = 4.0f * __real__ x;
-		  __real__ res = 0.25f * __log1pf (num / den);
-		}
-	    }
-
-	  float absx, absy, den;
-
-	  absx = fabsf (__real__ x);
-	  absy = fabsf (__imag__ x);
-	  if (absx < absy)
-	    {
-	      float t = absx;
-	      absx = absy;
-	      absy = t;
-	    }
-
-	  if (absy < FLT_EPSILON / 2.0f)
-	    {
-	      den = (1.0f - absx) * (1.0f + absx);
-	      if (den == -0.0f)
-		den = 0.0f;
-	    }
-	  else if (absx >= 1.0f)
-	    den = (1.0f - absx) * (1.0f + absx) - absy * absy;
-	  else if (absx >= 0.75f || absy >= 0.5f)
-	    den = -__x2y2m1f (absx, absy);
-	  else
-	    den = (1.0f - absx) * (1.0f + absx) - absy * absy;
-
-	  __imag__ res = 0.5f * __ieee754_atan2f (2.0f * __imag__ x, den);
-	}
-
-      math_check_force_underflow_complex (res);
-    }
-
-  return res;
-}
-#ifndef __catanhf
-weak_alias (__catanhf, catanhf)
-#endif
diff --git a/math/s_catanhl.c b/math/s_catanhl.c
deleted file mode 100644
index 4c8e871..0000000
--- a/math/s_catanhl.c
+++ /dev/null
@@ -1,141 +0,0 @@
-/* Return arc hyperbole tangent for long double value.
-   Copyright (C) 1997-2016 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, see
-   <http://www.gnu.org/licenses/>.  */
-
-#include <complex.h>
-#include <math.h>
-#include <math_private.h>
-#include <float.h>
-
-/* To avoid spurious overflows, use this definition to treat IBM long
-   double as approximating an IEEE-style format.  */
-#if LDBL_MANT_DIG == 106
-# undef LDBL_EPSILON
-# define LDBL_EPSILON 0x1p-106L
-#endif
-
-__complex__ long double
-__catanhl (__complex__ long double x)
-{
-  __complex__ long double res;
-  int rcls = fpclassify (__real__ x);
-  int icls = fpclassify (__imag__ x);
-
-  if (__glibc_unlikely (rcls <= FP_INFINITE || icls <= FP_INFINITE))
-    {
-      if (icls == FP_INFINITE)
-	{
-	  __real__ res = __copysignl (0.0, __real__ x);
-	  __imag__ res = __copysignl (M_PI_2l, __imag__ x);
-	}
-      else if (rcls == FP_INFINITE || rcls == FP_ZERO)
-	{
-	  __real__ res = __copysignl (0.0, __real__ x);
-	  if (icls >= FP_ZERO)
-	    __imag__ res = __copysignl (M_PI_2l, __imag__ x);
-	  else
-	    __imag__ res = __nanl ("");
-	}
-      else
-	{
-	  __real__ res = __nanl ("");
-	  __imag__ res = __nanl ("");
-	}
-    }
-  else if (__glibc_unlikely (rcls == FP_ZERO && icls == FP_ZERO))
-    {
-      res = x;
-    }
-  else
-    {
-      if (fabsl (__real__ x) >= 16.0L / LDBL_EPSILON
-	  || fabsl (__imag__ x) >= 16.0L / LDBL_EPSILON)
-	{
-	  __imag__ res = __copysignl (M_PI_2l, __imag__ x);
-	  if (fabsl (__imag__ x) <= 1.0L)
-	    __real__ res = 1.0L / __real__ x;
-	  else if (fabsl (__real__ x) <= 1.0L)
-	    __real__ res = __real__ x / __imag__ x / __imag__ x;
-	  else
-	    {
-	      long double h = __ieee754_hypotl (__real__ x / 2.0L,
-						__imag__ x / 2.0L);
-	      __real__ res = __real__ x / h / h / 4.0L;
-	    }
-	}
-      else
-	{
-	  if (fabsl (__real__ x) == 1.0L
-	      && fabsl (__imag__ x) < LDBL_EPSILON * LDBL_EPSILON)
-	    __real__ res = (__copysignl (0.5L, __real__ x)
-			    * (M_LN2l - __ieee754_logl (fabsl (__imag__ x))));
-	  else
-	    {
-	      long double i2 = 0.0;
-	      if (fabsl (__imag__ x) >= LDBL_EPSILON * LDBL_EPSILON)
-		i2 = __imag__ x * __imag__ x;
-
-	      long double num = 1.0L + __real__ x;
-	      num = i2 + num * num;
-
-	      long double den = 1.0L - __real__ x;
-	      den = i2 + den * den;
-
-	      long double f = num / den;
-	      if (f < 0.5L)
-		__real__ res = 0.25L * __ieee754_logl (f);
-	      else
-		{
-		  num = 4.0L * __real__ x;
-		  __real__ res = 0.25L * __log1pl (num / den);
-		}
-	    }
-
-	  long double absx, absy, den;
-
-	  absx = fabsl (__real__ x);
-	  absy = fabsl (__imag__ x);
-	  if (absx < absy)
-	    {
-	      long double t = absx;
-	      absx = absy;
-	      absy = t;
-	    }
-
-	  if (absy < LDBL_EPSILON / 2.0L)
-	    {
-	      den = (1.0L - absx) * (1.0L + absx);
-	      if (den == -0.0L)
-		den = 0.0L;
-	    }
-	  else if (absx >= 1.0L)
-	    den = (1.0L - absx) * (1.0L + absx) - absy * absy;
-	  else if (absx >= 0.75L || absy >= 0.5L)
-	    den = -__x2y2m1l (absx, absy);
-	  else
-	    den = (1.0L - absx) * (1.0L + absx) - absy * absy;
-
-	  __imag__ res = 0.5L * __ieee754_atan2l (2.0L * __imag__ x, den);
-	}
-
-      math_check_force_underflow_complex (res);
-    }
-
-  return res;
-}
-weak_alias (__catanhl, catanhl)
diff --git a/math/s_catanl.c b/math/s_catanl.c
deleted file mode 100644
index 4425002..0000000
--- a/math/s_catanl.c
+++ /dev/null
@@ -1,147 +0,0 @@
-/* Return arc tangent of complex long double value.
-   Copyright (C) 1997-2016 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, see
-   <http://www.gnu.org/licenses/>.  */
-
-#include <complex.h>
-#include <math.h>
-#include <math_private.h>
-#include <float.h>
-
-/* To avoid spurious overflows, use this definition to treat IBM long
-   double as approximating an IEEE-style format.  */
-#if LDBL_MANT_DIG == 106
-# undef LDBL_EPSILON
-# define LDBL_EPSILON 0x1p-106L
-#endif
-
-__complex__ long double
-__catanl (__complex__ long double x)
-{
-  __complex__ long double res;
-  int rcls = fpclassify (__real__ x);
-  int icls = fpclassify (__imag__ x);
-
-  if (__glibc_unlikely (rcls <= FP_INFINITE || icls <= FP_INFINITE))
-    {
-      if (rcls == FP_INFINITE)
-	{
-	  __real__ res = __copysignl (M_PI_2l, __real__ x);
-	  __imag__ res = __copysignl (0.0, __imag__ x);
-	}
-      else if (icls == FP_INFINITE)
-	{
-	  if (rcls >= FP_ZERO)
-	    __real__ res = __copysignl (M_PI_2l, __real__ x);
-	  else
-	    __real__ res = __nanl ("");
-	  __imag__ res = __copysignl (0.0, __imag__ x);
-	}
-      else if (icls == FP_ZERO || icls == FP_INFINITE)
-	{
-	  __real__ res = __nanl ("");
-	  __imag__ res = __copysignl (0.0, __imag__ x);
-	}
-      else
-	{
-	  __real__ res = __nanl ("");
-	  __imag__ res = __nanl ("");
-	}
-    }
-  else if (__glibc_unlikely (rcls == FP_ZERO && icls == FP_ZERO))
-    {
-      res = x;
-    }
-  else
-    {
-      if (fabsl (__real__ x) >= 16.0L / LDBL_EPSILON
-	  || fabsl (__imag__ x) >= 16.0L / LDBL_EPSILON)
-	{
-	  __real__ res = __copysignl (M_PI_2l, __real__ x);
-	  if (fabsl (__real__ x) <= 1.0L)
-	    __imag__ res = 1.0L / __imag__ x;
-	  else if (fabsl (__imag__ x) <= 1.0L)
-	    __imag__ res = __imag__ x / __real__ x / __real__ x;
-	  else
-	    {
-	      long double h = __ieee754_hypotl (__real__ x / 2.0L,
-						__imag__ x / 2.0L);
-	      __imag__ res = __imag__ x / h / h / 4.0L;
-	    }
-	}
-      else
-	{
-	  long double den, absx, absy;
-
-	  absx = fabsl (__real__ x);
-	  absy = fabsl (__imag__ x);
-	  if (absx < absy)
-	    {
-	      long double t = absx;
-	      absx = absy;
-	      absy = t;
-	    }
-
-	  if (absy < LDBL_EPSILON / 2.0L)
-	    {
-	      den = (1.0L - absx) * (1.0L + absx);
-	      if (den == -0.0L)
-		den = 0.0L;
-	    }
-	  else if (absx >= 1.0L)
-	    den = (1.0L - absx) * (1.0L + absx) - absy * absy;
-	  else if (absx >= 0.75L || absy >= 0.5L)
-	    den = -__x2y2m1l (absx, absy);
-	  else
-	    den = (1.0L - absx) * (1.0L + absx) - absy * absy;
-
-	  __real__ res = 0.5L * __ieee754_atan2l (2.0L * __real__ x, den);
-
-	  if (fabsl (__imag__ x) == 1.0L
-	      && fabsl (__real__ x) < LDBL_EPSILON * LDBL_EPSILON)
-	    __imag__ res = (__copysignl (0.5L, __imag__ x)
-			    * (M_LN2l - __ieee754_logl (fabsl (__real__ x))));
-	  else
-	    {
-	      long double r2 = 0.0L, num, f;
-
-	      if (fabsl (__real__ x) >= LDBL_EPSILON * LDBL_EPSILON)
-		r2 = __real__ x * __real__ x;
-
-	      num = __imag__ x + 1.0L;
-	      num = r2 + num * num;
-
-	      den = __imag__ x - 1.0L;
-	      den = r2 + den * den;
-
-	      f = num / den;
-	      if (f < 0.5L)
-		__imag__ res = 0.25L * __ieee754_logl (f);
-	      else
-		{
-		  num = 4.0L * __imag__ x;
-		  __imag__ res = 0.25L * __log1pl (num / den);
-		}
-	    }
-	}
-
-      math_check_force_underflow_complex (res);
-    }
-
-  return res;
-}
-weak_alias (__catanl, catanl)
diff --git a/math/s_ctan.c b/math/s_ctan.c
deleted file mode 100644
index 8e8bf2e..0000000
--- a/math/s_ctan.c
+++ /dev/null
@@ -1,129 +0,0 @@
-/* Complex tangent function for double.
-   Copyright (C) 1997-2016 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, see
-   <http://www.gnu.org/licenses/>.  */
-
-#include <complex.h>
-#include <fenv.h>
-#include <math.h>
-#include <math_private.h>
-#include <float.h>
-
-__complex__ double
-__ctan (__complex__ double x)
-{
-  __complex__ double res;
-
-  if (__glibc_unlikely (!isfinite (__real__ x) || !isfinite (__imag__ x)))
-    {
-      if (isinf (__imag__ x))
-	{
-	  if (isfinite (__real__ x) && fabs (__real__ x) > 1.0)
-	    {
-	      double sinrx, cosrx;
-	      __sincos (__real__ x, &sinrx, &cosrx);
-	      __real__ res = __copysign (0.0, sinrx * cosrx);
-	    }
-	  else
-	    __real__ res = __copysign (0.0, __real__ x);
-	  __imag__ res = __copysign (1.0, __imag__ x);
-	}
-      else if (__real__ x == 0.0)
-	{
-	  res = x;
-	}
-      else
-	{
-	  __real__ res = __nan ("");
-	  __imag__ res = __nan ("");
-
-	  if (isinf (__real__ x))
-	    feraiseexcept (FE_INVALID);
-	}
-    }
-  else
-    {
-      double sinrx, cosrx;
-      double den;
-      const int t = (int) ((DBL_MAX_EXP - 1) * M_LN2 / 2);
-
-      /* tan(x+iy) = (sin(2x) + i*sinh(2y))/(cos(2x) + cosh(2y))
-	 = (sin(x)*cos(x) + i*sinh(y)*cosh(y)/(cos(x)^2 + sinh(y)^2). */
-
-      if (__glibc_likely (fabs (__real__ x) > DBL_MIN))
-	{
-	  __sincos (__real__ x, &sinrx, &cosrx);
-	}
-      else
-	{
-	  sinrx = __real__ x;
-	  cosrx = 1.0;
-	}
-
-      if (fabs (__imag__ x) > t)
-	{
-	  /* Avoid intermediate overflow when the real part of the
-	     result may be subnormal.  Ignoring negligible terms, the
-	     imaginary part is +/- 1, the real part is
-	     sin(x)*cos(x)/sinh(y)^2 = 4*sin(x)*cos(x)/exp(2y).  */
-	  double exp_2t = __ieee754_exp (2 * t);
-
-	  __imag__ res = __copysign (1.0, __imag__ x);
-	  __real__ res = 4 * sinrx * cosrx;
-	  __imag__ x = fabs (__imag__ x);
-	  __imag__ x -= t;
-	  __real__ res /= exp_2t;
-	  if (__imag__ x > t)
-	    {
-	      /* Underflow (original imaginary part of x has absolute
-		 value > 2t).  */
-	      __real__ res /= exp_2t;
-	    }
-	  else
-	    __real__ res /= __ieee754_exp (2 * __imag__ x);
-	}
-      else
-	{
-	  double sinhix, coshix;
-	  if (fabs (__imag__ x) > DBL_MIN)
-	    {
-	      sinhix = __ieee754_sinh (__imag__ x);
-	      coshix = __ieee754_cosh (__imag__ x);
-	    }
-	  else
-	    {
-	      sinhix = __imag__ x;
-	      coshix = 1.0;
-	    }
-
-	  if (fabs (sinhix) > fabs (cosrx) * DBL_EPSILON)
-	    den = cosrx * cosrx + sinhix * sinhix;
-	  else
-	    den = cosrx * cosrx;
-	  __real__ res = sinrx * cosrx / den;
-	  __imag__ res = sinhix * coshix / den;
-	}
-      math_check_force_underflow_complex (res);
-    }
-
-  return res;
-}
-weak_alias (__ctan, ctan)
-#ifdef NO_LONG_DOUBLE
-strong_alias (__ctan, __ctanl)
-weak_alias (__ctan, ctanl)
-#endif
diff --git a/math/s_ctan_template.c b/math/s_ctan_template.c
index 8e8bf2e..96efa47 100644
--- a/math/s_ctan_template.c
+++ b/math/s_ctan_template.c
@@ -1,4 +1,4 @@
-/* Complex tangent function for double.
+/* Complex tangent function for a complex float type.
    Copyright (C) 1997-2016 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
@@ -23,33 +23,33 @@
 #include <math_private.h>
 #include <float.h>
 
-__complex__ double
-__ctan (__complex__ double x)
+CFLOAT
+M_DECL_FUNC (__ctan) (CFLOAT x)
 {
-  __complex__ double res;
+  CFLOAT res;
 
   if (__glibc_unlikely (!isfinite (__real__ x) || !isfinite (__imag__ x)))
     {
       if (isinf (__imag__ x))
 	{
-	  if (isfinite (__real__ x) && fabs (__real__ x) > 1.0)
+	  if (isfinite (__real__ x) && M_FABS (__real__ x) > 1)
 	    {
-	      double sinrx, cosrx;
-	      __sincos (__real__ x, &sinrx, &cosrx);
-	      __real__ res = __copysign (0.0, sinrx * cosrx);
+	      FLOAT sinrx, cosrx;
+	      M_SINCOS (__real__ x, &sinrx, &cosrx);
+	      __real__ res = M_COPYSIGN (0, sinrx * cosrx);
 	    }
 	  else
-	    __real__ res = __copysign (0.0, __real__ x);
-	  __imag__ res = __copysign (1.0, __imag__ x);
+	    __real__ res = M_COPYSIGN (0, __real__ x);
+	  __imag__ res = M_COPYSIGN (1, __imag__ x);
 	}
-      else if (__real__ x == 0.0)
+      else if (__real__ x == 0)
 	{
 	  res = x;
 	}
       else
 	{
-	  __real__ res = __nan ("");
-	  __imag__ res = __nan ("");
+	  __real__ res = M_NAN;
+	  __imag__ res = M_NAN;
 
 	  if (isinf (__real__ x))
 	    feraiseexcept (FE_INVALID);
@@ -57,34 +57,34 @@ __ctan (__complex__ double x)
     }
   else
     {
-      double sinrx, cosrx;
-      double den;
-      const int t = (int) ((DBL_MAX_EXP - 1) * M_LN2 / 2);
+      FLOAT sinrx, cosrx;
+      FLOAT den;
+      const int t = (int) ((M_MAX_EXP - 1) * M_MLIT (M_LN2) / 2);
 
       /* tan(x+iy) = (sin(2x) + i*sinh(2y))/(cos(2x) + cosh(2y))
 	 = (sin(x)*cos(x) + i*sinh(y)*cosh(y)/(cos(x)^2 + sinh(y)^2). */
 
-      if (__glibc_likely (fabs (__real__ x) > DBL_MIN))
+      if (__glibc_likely (M_FABS (__real__ x) > M_MIN))
 	{
-	  __sincos (__real__ x, &sinrx, &cosrx);
+	  M_SINCOS (__real__ x, &sinrx, &cosrx);
 	}
       else
 	{
 	  sinrx = __real__ x;
-	  cosrx = 1.0;
+	  cosrx = 1;
 	}
 
-      if (fabs (__imag__ x) > t)
+      if (M_FABS (__imag__ x) > t)
 	{
 	  /* Avoid intermediate overflow when the real part of the
 	     result may be subnormal.  Ignoring negligible terms, the
 	     imaginary part is +/- 1, the real part is
 	     sin(x)*cos(x)/sinh(y)^2 = 4*sin(x)*cos(x)/exp(2y).  */
-	  double exp_2t = __ieee754_exp (2 * t);
+	  FLOAT exp_2t = M_EXP (2 * t);
 
-	  __imag__ res = __copysign (1.0, __imag__ x);
+	  __imag__ res = M_COPYSIGN (1, __imag__ x);
 	  __real__ res = 4 * sinrx * cosrx;
-	  __imag__ x = fabs (__imag__ x);
+	  __imag__ x = M_FABS (__imag__ x);
 	  __imag__ x -= t;
 	  __real__ res /= exp_2t;
 	  if (__imag__ x > t)
@@ -94,23 +94,23 @@ __ctan (__complex__ double x)
 	      __real__ res /= exp_2t;
 	    }
 	  else
-	    __real__ res /= __ieee754_exp (2 * __imag__ x);
+	    __real__ res /= M_EXP (2 * __imag__ x);
 	}
       else
 	{
-	  double sinhix, coshix;
-	  if (fabs (__imag__ x) > DBL_MIN)
+	  FLOAT sinhix, coshix;
+	  if (M_FABS (__imag__ x) > M_MIN)
 	    {
-	      sinhix = __ieee754_sinh (__imag__ x);
-	      coshix = __ieee754_cosh (__imag__ x);
+	      sinhix = M_SINH (__imag__ x);
+	      coshix = M_COSH (__imag__ x);
 	    }
 	  else
 	    {
 	      sinhix = __imag__ x;
-	      coshix = 1.0;
+	      coshix = 1;
 	    }
 
-	  if (fabs (sinhix) > fabs (cosrx) * DBL_EPSILON)
+	  if (M_FABS (sinhix) > M_FABS (cosrx) * M_EPSILON)
 	    den = cosrx * cosrx + sinhix * sinhix;
 	  else
 	    den = cosrx * cosrx;
@@ -122,8 +122,9 @@ __ctan (__complex__ double x)
 
   return res;
 }
-weak_alias (__ctan, ctan)
-#ifdef NO_LONG_DOUBLE
-strong_alias (__ctan, __ctanl)
-weak_alias (__ctan, ctanl)
+
+declare_mgen_alias (__ctan, ctan)
+
+#if M_LIBM_NEED_COMPAT (ctan)
+declare_mgen_libm_compat (__ctan, ctan)
 #endif
diff --git a/math/s_ctanf.c b/math/s_ctanf.c
deleted file mode 100644
index 0db2c90..0000000
--- a/math/s_ctanf.c
+++ /dev/null
@@ -1,127 +0,0 @@
-/* Complex tangent function for float.
-   Copyright (C) 1997-2016 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, see
-   <http://www.gnu.org/licenses/>.  */
-
-#include <complex.h>
-#include <fenv.h>
-#include <math.h>
-#include <math_private.h>
-#include <float.h>
-
-__complex__ float
-__ctanf (__complex__ float x)
-{
-  __complex__ float res;
-
-  if (__glibc_unlikely (!isfinite (__real__ x) || !isfinite (__imag__ x)))
-    {
-      if (isinf (__imag__ x))
-	{
-	  if (isfinite (__real__ x) && fabsf (__real__ x) > 1.0f)
-	    {
-	      float sinrx, cosrx;
-	      __sincosf (__real__ x, &sinrx, &cosrx);
-	      __real__ res = __copysignf (0.0f, sinrx * cosrx);
-	    }
-	  else
-	    __real__ res = __copysignf (0.0, __real__ x);
-	  __imag__ res = __copysignf (1.0, __imag__ x);
-	}
-      else if (__real__ x == 0.0)
-	{
-	  res = x;
-	}
-      else
-	{
-	  __real__ res = __nanf ("");
-	  __imag__ res = __nanf ("");
-
-	  if (isinf (__real__ x))
-	    feraiseexcept (FE_INVALID);
-	}
-    }
-  else
-    {
-      float sinrx, cosrx;
-      float den;
-      const int t = (int) ((FLT_MAX_EXP - 1) * M_LN2 / 2);
-
-      /* tan(x+iy) = (sin(2x) + i*sinh(2y))/(cos(2x) + cosh(2y))
-	 = (sin(x)*cos(x) + i*sinh(y)*cosh(y)/(cos(x)^2 + sinh(y)^2). */
-
-      if (__glibc_likely (fabsf (__real__ x) > FLT_MIN))
-	{
-	  __sincosf (__real__ x, &sinrx, &cosrx);
-	}
-      else
-	{
-	  sinrx = __real__ x;
-	  cosrx = 1.0f;
-	}
-
-      if (fabsf (__imag__ x) > t)
-	{
-	  /* Avoid intermediate overflow when the real part of the
-	     result may be subnormal.  Ignoring negligible terms, the
-	     imaginary part is +/- 1, the real part is
-	     sin(x)*cos(x)/sinh(y)^2 = 4*sin(x)*cos(x)/exp(2y).  */
-	  float exp_2t = __ieee754_expf (2 * t);
-
-	  __imag__ res = __copysignf (1.0, __imag__ x);
-	  __real__ res = 4 * sinrx * cosrx;
-	  __imag__ x = fabsf (__imag__ x);
-	  __imag__ x -= t;
-	  __real__ res /= exp_2t;
-	  if (__imag__ x > t)
-	    {
-	      /* Underflow (original imaginary part of x has absolute
-		 value > 2t).  */
-	      __real__ res /= exp_2t;
-	    }
-	  else
-	    __real__ res /= __ieee754_expf (2 * __imag__ x);
-	}
-      else
-	{
-	  float sinhix, coshix;
-	  if (fabsf (__imag__ x) > FLT_MIN)
-	    {
-	      sinhix = __ieee754_sinhf (__imag__ x);
-	      coshix = __ieee754_coshf (__imag__ x);
-	    }
-	  else
-	    {
-	      sinhix = __imag__ x;
-	      coshix = 1.0f;
-	    }
-
-	  if (fabsf (sinhix) > fabsf (cosrx) * FLT_EPSILON)
-	    den = cosrx * cosrx + sinhix * sinhix;
-	  else
-	    den = cosrx * cosrx;
-	  __real__ res = sinrx * cosrx / den;
-	  __imag__ res = sinhix * coshix / den;
-	}
-      math_check_force_underflow_complex (res);
-    }
-
-  return res;
-}
-#ifndef __ctanf
-weak_alias (__ctanf, ctanf)
-#endif
diff --git a/math/s_ctanh.c b/math/s_ctanh.c
deleted file mode 100644
index 2d18875..0000000
--- a/math/s_ctanh.c
+++ /dev/null
@@ -1,129 +0,0 @@
-/* Complex hyperbole tangent for double.
-   Copyright (C) 1997-2016 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, see
-   <http://www.gnu.org/licenses/>.  */
-
-#include <complex.h>
-#include <fenv.h>
-#include <math.h>
-#include <math_private.h>
-#include <float.h>
-
-__complex__ double
-__ctanh (__complex__ double x)
-{
-  __complex__ double res;
-
-  if (__glibc_unlikely (!isfinite (__real__ x) || !isfinite (__imag__ x)))
-    {
-      if (isinf (__real__ x))
-	{
-	  __real__ res = __copysign (1.0, __real__ x);
-	  if (isfinite (__imag__ x) && fabs (__imag__ x) > 1.0)
-	    {
-	      double sinix, cosix;
-	      __sincos (__imag__ x, &sinix, &cosix);
-	      __imag__ res = __copysign (0.0, sinix * cosix);
-	    }
-	  else
-	    __imag__ res = __copysign (0.0, __imag__ x);
-	}
-      else if (__imag__ x == 0.0)
-	{
-	  res = x;
-	}
-      else
-	{
-	  __real__ res = __nan ("");
-	  __imag__ res = __nan ("");
-
-	  if (isinf (__imag__ x))
-	    feraiseexcept (FE_INVALID);
-	}
-    }
-  else
-    {
-      double sinix, cosix;
-      double den;
-      const int t = (int) ((DBL_MAX_EXP - 1) * M_LN2 / 2);
-
-      /* tanh(x+iy) = (sinh(2x) + i*sin(2y))/(cosh(2x) + cos(2y))
-	 = (sinh(x)*cosh(x) + i*sin(y)*cos(y))/(sinh(x)^2 + cos(y)^2).  */
-
-      if (__glibc_likely (fabs (__imag__ x) > DBL_MIN))
-	{
-	  __sincos (__imag__ x, &sinix, &cosix);
-	}
-      else
-	{
-	  sinix = __imag__ x;
-	  cosix = 1.0;
-	}
-
-      if (fabs (__real__ x) > t)
-	{
-	  /* Avoid intermediate overflow when the imaginary part of
-	     the result may be subnormal.  Ignoring negligible terms,
-	     the real part is +/- 1, the imaginary part is
-	     sin(y)*cos(y)/sinh(x)^2 = 4*sin(y)*cos(y)/exp(2x).  */
-	  double exp_2t = __ieee754_exp (2 * t);
-
-	  __real__ res = __copysign (1.0, __real__ x);
-	  __imag__ res = 4 * sinix * cosix;
-	  __real__ x = fabs (__real__ x);
-	  __real__ x -= t;
-	  __imag__ res /= exp_2t;
-	  if (__real__ x > t)
-	    {
-	      /* Underflow (original real part of x has absolute value
-		 > 2t).  */
-	      __imag__ res /= exp_2t;
-	    }
-	  else
-	    __imag__ res /= __ieee754_exp (2 * __real__ x);
-	}
-      else
-	{
-	  double sinhrx, coshrx;
-	  if (fabs (__real__ x) > DBL_MIN)
-	    {
-	      sinhrx = __ieee754_sinh (__real__ x);
-	      coshrx = __ieee754_cosh (__real__ x);
-	    }
-	  else
-	    {
-	      sinhrx = __real__ x;
-	      coshrx = 1.0;
-	    }
-
-	  if (fabs (sinhrx) > fabs (cosix) * DBL_EPSILON)
-	    den = sinhrx * sinhrx + cosix * cosix;
-	  else
-	    den = cosix * cosix;
-	  __real__ res = sinhrx * coshrx / den;
-	  __imag__ res = sinix * cosix / den;
-	}
-      math_check_force_underflow_complex (res);
-    }
-
-  return res;
-}
-weak_alias (__ctanh, ctanh)
-#ifdef NO_LONG_DOUBLE
-strong_alias (__ctanh, __ctanhl)
-weak_alias (__ctanh, ctanhl)
-#endif
diff --git a/math/s_ctanh_template.c b/math/s_ctanh_template.c
index 2d18875..a7b7ebc 100644
--- a/math/s_ctanh_template.c
+++ b/math/s_ctanh_template.c
@@ -1,4 +1,4 @@
-/* Complex hyperbole tangent for double.
+/* Complex hyperbolic tangent for float types.
    Copyright (C) 1997-2016 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
@@ -23,33 +23,33 @@
 #include <math_private.h>
 #include <float.h>
 
-__complex__ double
-__ctanh (__complex__ double x)
+CFLOAT
+M_DECL_FUNC (__ctanh) (CFLOAT x)
 {
-  __complex__ double res;
+  CFLOAT res;
 
   if (__glibc_unlikely (!isfinite (__real__ x) || !isfinite (__imag__ x)))
     {
       if (isinf (__real__ x))
 	{
-	  __real__ res = __copysign (1.0, __real__ x);
-	  if (isfinite (__imag__ x) && fabs (__imag__ x) > 1.0)
+	  __real__ res = M_COPYSIGN (1, __real__ x);
+	  if (isfinite (__imag__ x) && M_FABS (__imag__ x) > 1)
 	    {
-	      double sinix, cosix;
-	      __sincos (__imag__ x, &sinix, &cosix);
-	      __imag__ res = __copysign (0.0, sinix * cosix);
+	      FLOAT sinix, cosix;
+	      M_SINCOS (__imag__ x, &sinix, &cosix);
+	      __imag__ res = M_COPYSIGN (0, sinix * cosix);
 	    }
 	  else
-	    __imag__ res = __copysign (0.0, __imag__ x);
+	    __imag__ res = M_COPYSIGN (0, __imag__ x);
 	}
-      else if (__imag__ x == 0.0)
+      else if (__imag__ x == 0)
 	{
 	  res = x;
 	}
       else
 	{
-	  __real__ res = __nan ("");
-	  __imag__ res = __nan ("");
+	  __real__ res = M_NAN;
+	  __imag__ res = M_NAN;
 
 	  if (isinf (__imag__ x))
 	    feraiseexcept (FE_INVALID);
@@ -57,34 +57,34 @@ __ctanh (__complex__ double x)
     }
   else
     {
-      double sinix, cosix;
-      double den;
-      const int t = (int) ((DBL_MAX_EXP - 1) * M_LN2 / 2);
+      FLOAT sinix, cosix;
+      FLOAT den;
+      const int t = (int) ((M_MAX_EXP - 1) * M_MLIT (M_LN2) / 2);
 
       /* tanh(x+iy) = (sinh(2x) + i*sin(2y))/(cosh(2x) + cos(2y))
 	 = (sinh(x)*cosh(x) + i*sin(y)*cos(y))/(sinh(x)^2 + cos(y)^2).  */
 
-      if (__glibc_likely (fabs (__imag__ x) > DBL_MIN))
+      if (__glibc_likely (M_FABS (__imag__ x) > M_MIN))
 	{
-	  __sincos (__imag__ x, &sinix, &cosix);
+	  M_SINCOS (__imag__ x, &sinix, &cosix);
 	}
       else
 	{
 	  sinix = __imag__ x;
-	  cosix = 1.0;
+	  cosix = 1;
 	}
 
-      if (fabs (__real__ x) > t)
+      if (M_FABS (__real__ x) > t)
 	{
 	  /* Avoid intermediate overflow when the imaginary part of
 	     the result may be subnormal.  Ignoring negligible terms,
 	     the real part is +/- 1, the imaginary part is
 	     sin(y)*cos(y)/sinh(x)^2 = 4*sin(y)*cos(y)/exp(2x).  */
-	  double exp_2t = __ieee754_exp (2 * t);
+	  FLOAT exp_2t = M_EXP (2 * t);
 
-	  __real__ res = __copysign (1.0, __real__ x);
+	  __real__ res = M_COPYSIGN (1, __real__ x);
 	  __imag__ res = 4 * sinix * cosix;
-	  __real__ x = fabs (__real__ x);
+	  __real__ x = M_FABS (__real__ x);
 	  __real__ x -= t;
 	  __imag__ res /= exp_2t;
 	  if (__real__ x > t)
@@ -94,23 +94,23 @@ __ctanh (__complex__ double x)
 	      __imag__ res /= exp_2t;
 	    }
 	  else
-	    __imag__ res /= __ieee754_exp (2 * __real__ x);
+	    __imag__ res /= M_EXP (2 * __real__ x);
 	}
       else
 	{
-	  double sinhrx, coshrx;
-	  if (fabs (__real__ x) > DBL_MIN)
+	  FLOAT sinhrx, coshrx;
+	  if (M_FABS (__real__ x) > M_MIN)
 	    {
-	      sinhrx = __ieee754_sinh (__real__ x);
-	      coshrx = __ieee754_cosh (__real__ x);
+	      sinhrx = M_SINH (__real__ x);
+	      coshrx = M_COSH (__real__ x);
 	    }
 	  else
 	    {
 	      sinhrx = __real__ x;
-	      coshrx = 1.0;
+	      coshrx = 1;
 	    }
 
-	  if (fabs (sinhrx) > fabs (cosix) * DBL_EPSILON)
+	  if (M_FABS (sinhrx) > M_FABS (cosix) * M_EPSILON)
 	    den = sinhrx * sinhrx + cosix * cosix;
 	  else
 	    den = cosix * cosix;
@@ -122,8 +122,9 @@ __ctanh (__complex__ double x)
 
   return res;
 }
-weak_alias (__ctanh, ctanh)
-#ifdef NO_LONG_DOUBLE
-strong_alias (__ctanh, __ctanhl)
-weak_alias (__ctanh, ctanhl)
+
+declare_mgen_alias (__ctanh, ctanh)
+
+#if M_LIBM_NEED_COMPAT (ctanh)
+declare_mgen_libm_compat (__ctanh, ctanh)
 #endif
diff --git a/math/s_ctanhf.c b/math/s_ctanhf.c
deleted file mode 100644
index ffe95f6..0000000
--- a/math/s_ctanhf.c
+++ /dev/null
@@ -1,127 +0,0 @@
-/* Complex hyperbole tangent for float.
-   Copyright (C) 1997-2016 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, see
-   <http://www.gnu.org/licenses/>.  */
-
-#include <complex.h>
-#include <fenv.h>
-#include <math.h>
-#include <math_private.h>
-#include <float.h>
-
-__complex__ float
-__ctanhf (__complex__ float x)
-{
-  __complex__ float res;
-
-  if (__glibc_unlikely (!isfinite (__real__ x) || !isfinite (__imag__ x)))
-    {
-      if (isinf (__real__ x))
-	{
-	  __real__ res = __copysignf (1.0, __real__ x);
-	  if (isfinite (__imag__ x) && fabsf (__imag__ x) > 1.0f)
-	    {
-	      float sinix, cosix;
-	      __sincosf (__imag__ x, &sinix, &cosix);
-	      __imag__ res = __copysignf (0.0f, sinix * cosix);
-	    }
-	  else
-	    __imag__ res = __copysignf (0.0, __imag__ x);
-	}
-      else if (__imag__ x == 0.0)
-	{
-	  res = x;
-	}
-      else
-	{
-	  __real__ res = __nanf ("");
-	  __imag__ res = __nanf ("");
-
-	  if (isinf (__imag__ x))
-	    feraiseexcept (FE_INVALID);
-	}
-    }
-  else
-    {
-      float sinix, cosix;
-      float den;
-      const int t = (int) ((FLT_MAX_EXP - 1) * M_LN2 / 2);
-
-      /* tanh(x+iy) = (sinh(2x) + i*sin(2y))/(cosh(2x) + cos(2y))
-	 = (sinh(x)*cosh(x) + i*sin(y)*cos(y))/(sinh(x)^2 + cos(y)^2).  */
-
-      if (__glibc_likely (fabsf (__imag__ x) > FLT_MIN))
-	{
-	  __sincosf (__imag__ x, &sinix, &cosix);
-	}
-      else
-	{
-	  sinix = __imag__ x;
-	  cosix = 1.0f;
-	}
-
-      if (fabsf (__real__ x) > t)
-	{
-	  /* Avoid intermediate overflow when the imaginary part of
-	     the result may be subnormal.  Ignoring negligible terms,
-	     the real part is +/- 1, the imaginary part is
-	     sin(y)*cos(y)/sinh(x)^2 = 4*sin(y)*cos(y)/exp(2x).  */
-	  float exp_2t = __ieee754_expf (2 * t);
-
-	  __real__ res = __copysignf (1.0, __real__ x);
-	  __imag__ res = 4 * sinix * cosix;
-	  __real__ x = fabsf (__real__ x);
-	  __real__ x -= t;
-	  __imag__ res /= exp_2t;
-	  if (__real__ x > t)
-	    {
-	      /* Underflow (original real part of x has absolute value
-		 > 2t).  */
-	      __imag__ res /= exp_2t;
-	    }
-	  else
-	    __imag__ res /= __ieee754_expf (2 * __real__ x);
-	}
-      else
-	{
-	  float sinhrx, coshrx;
-	  if (fabsf (__real__ x) > FLT_MIN)
-	    {
-	      sinhrx = __ieee754_sinhf (__real__ x);
-	      coshrx = __ieee754_coshf (__real__ x);
-	    }
-	  else
-	    {
-	      sinhrx = __real__ x;
-	      coshrx = 1.0f;
-	    }
-
-	  if (fabsf (sinhrx) > fabsf (cosix) * FLT_EPSILON)
-	    den = sinhrx * sinhrx + cosix * cosix;
-	  else
-	    den = cosix * cosix;
-	  __real__ res = sinhrx * coshrx / den;
-	  __imag__ res = sinix * cosix / den;
-	}
-      math_check_force_underflow_complex (res);
-    }
-
-  return res;
-}
-#ifndef __ctanhf
-weak_alias (__ctanhf, ctanhf)
-#endif
diff --git a/math/s_ctanhl.c b/math/s_ctanhl.c
deleted file mode 100644
index 3404d06..0000000
--- a/math/s_ctanhl.c
+++ /dev/null
@@ -1,132 +0,0 @@
-/* Complex hyperbole tangent for long double.
-   Copyright (C) 1997-2016 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, see
-   <http://www.gnu.org/licenses/>.  */
-
-#include <complex.h>
-#include <fenv.h>
-#include <math.h>
-#include <math_private.h>
-#include <float.h>
-
-/* To avoid spurious underflows, use this definition to treat IBM long
-   double as approximating an IEEE-style format.  */
-#if LDBL_MANT_DIG == 106
-# undef LDBL_EPSILON
-# define LDBL_EPSILON 0x1p-106L
-#endif
-
-__complex__ long double
-__ctanhl (__complex__ long double x)
-{
-  __complex__ long double res;
-
-  if (__glibc_unlikely (!isfinite (__real__ x) || !isfinite (__imag__ x)))
-    {
-      if (isinf (__real__ x))
-	{
-	  __real__ res = __copysignl (1.0, __real__ x);
-	  if (isfinite (__imag__ x) && fabsl (__imag__ x) > 1.0L)
-	    {
-	      long double sinix, cosix;
-	      __sincosl (__imag__ x, &sinix, &cosix);
-	      __imag__ res = __copysignl (0.0L, sinix * cosix);
-	    }
-	  else
-	    __imag__ res = __copysignl (0.0, __imag__ x);
-	}
-      else if (__imag__ x == 0.0)
-	{
-	  res = x;
-	}
-      else
-	{
-	  __real__ res = __nanl ("");
-	  __imag__ res = __nanl ("");
-
-	  if (isinf (__imag__ x))
-	    feraiseexcept (FE_INVALID);
-	}
-    }
-  else
-    {
-      long double sinix, cosix;
-      long double den;
-      const int t = (int) ((LDBL_MAX_EXP - 1) * M_LN2l / 2);
-
-      /* tanh(x+iy) = (sinh(2x) + i*sin(2y))/(cosh(2x) + cos(2y))
-	 = (sinh(x)*cosh(x) + i*sin(y)*cos(y))/(sinh(x)^2 + cos(y)^2).  */
-
-      if (__glibc_likely (fabsl (__imag__ x) > LDBL_MIN))
-	{
-	  __sincosl (__imag__ x, &sinix, &cosix);
-	}
-      else
-	{
-	  sinix = __imag__ x;
-	  cosix = 1.0;
-	}
-
-      if (fabsl (__real__ x) > t)
-	{
-	  /* Avoid intermediate overflow when the imaginary part of
-	     the result may be subnormal.  Ignoring negligible terms,
-	     the real part is +/- 1, the imaginary part is
-	     sin(y)*cos(y)/sinh(x)^2 = 4*sin(y)*cos(y)/exp(2x).  */
-	  long double exp_2t = __ieee754_expl (2 * t);
-
-	  __real__ res = __copysignl (1.0, __real__ x);
-	  __imag__ res = 4 * sinix * cosix;
-	  __real__ x = fabsl (__real__ x);
-	  __real__ x -= t;
-	  __imag__ res /= exp_2t;
-	  if (__real__ x > t)
-	    {
-	      /* Underflow (original real part of x has absolute value
-		 > 2t).  */
-	      __imag__ res /= exp_2t;
-	    }
-	  else
-	    __imag__ res /= __ieee754_expl (2 * __real__ x);
-	}
-      else
-	{
-	  long double sinhrx, coshrx;
-	  if (fabsl (__real__ x) > LDBL_MIN)
-	    {
-	      sinhrx = __ieee754_sinhl (__real__ x);
-	      coshrx = __ieee754_coshl (__real__ x);
-	    }
-	  else
-	    {
-	      sinhrx = __real__ x;
-	      coshrx = 1.0L;
-	    }
-
-	  if (fabsl (sinhrx) > fabsl (cosix) * LDBL_EPSILON)
-	    den = sinhrx * sinhrx + cosix * cosix;
-	  else
-	    den = cosix * cosix;
-	  __real__ res = sinhrx * coshrx / den;
-	  __imag__ res = sinix * cosix / den;
-	}
-      math_check_force_underflow_complex (res);
-    }
-
-  return res;
-}
-weak_alias (__ctanhl, ctanhl)
diff --git a/math/s_ctanl.c b/math/s_ctanl.c
deleted file mode 100644
index d6be22d..0000000
--- a/math/s_ctanl.c
+++ /dev/null
@@ -1,132 +0,0 @@
-/* Complex tangent function for long double.
-   Copyright (C) 1997-2016 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, see
-   <http://www.gnu.org/licenses/>.  */
-
-#include <complex.h>
-#include <fenv.h>
-#include <math.h>
-#include <math_private.h>
-#include <float.h>
-
-/* To avoid spurious underflows, use this definition to treat IBM long
-   double as approximating an IEEE-style format.  */
-#if LDBL_MANT_DIG == 106
-# undef LDBL_EPSILON
-# define LDBL_EPSILON 0x1p-106L
-#endif
-
-__complex__ long double
-__ctanl (__complex__ long double x)
-{
-  __complex__ long double res;
-
-  if (__glibc_unlikely (!isfinite (__real__ x) || !isfinite (__imag__ x)))
-    {
-      if (isinf (__imag__ x))
-	{
-	  if (isfinite (__real__ x) &&  fabsl (__real__ x) > 1.0L)
-	    {
-	      long double sinrx, cosrx;
-	      __sincosl (__real__ x, &sinrx, &cosrx);
-	      __real__ res = __copysignl (0.0L, sinrx * cosrx);
-	    }
-	  else
-	    __real__ res = __copysignl (0.0, __real__ x);
-	  __imag__ res = __copysignl (1.0, __imag__ x);
-	}
-      else if (__real__ x == 0.0)
-	{
-	  res = x;
-	}
-      else
-	{
-	  __real__ res = __nanl ("");
-	  __imag__ res = __nanl ("");
-
-	  if (isinf (__real__ x))
-	    feraiseexcept (FE_INVALID);
-	}
-    }
-  else
-    {
-      long double sinrx, cosrx;
-      long double den;
-      const int t = (int) ((LDBL_MAX_EXP - 1) * M_LN2l / 2);
-
-      /* tan(x+iy) = (sin(2x) + i*sinh(2y))/(cos(2x) + cosh(2y))
-	 = (sin(x)*cos(x) + i*sinh(y)*cosh(y)/(cos(x)^2 + sinh(y)^2). */
-
-      if (__glibc_likely (fabsl (__real__ x) > LDBL_MIN))
-	{
-	  __sincosl (__real__ x, &sinrx, &cosrx);
-	}
-      else
-	{
-	  sinrx = __real__ x;
-	  cosrx = 1.0;
-	}
-
-      if (fabsl (__imag__ x) > t)
-	{
-	  /* Avoid intermediate overflow when the real part of the
-	     result may be subnormal.  Ignoring negligible terms, the
-	     imaginary part is +/- 1, the real part is
-	     sin(x)*cos(x)/sinh(y)^2 = 4*sin(x)*cos(x)/exp(2y).  */
-	  long double exp_2t = __ieee754_expl (2 * t);
-
-	  __imag__ res = __copysignl (1.0, __imag__ x);
-	  __real__ res = 4 * sinrx * cosrx;
-	  __imag__ x = fabsl (__imag__ x);
-	  __imag__ x -= t;
-	  __real__ res /= exp_2t;
-	  if (__imag__ x > t)
-	    {
-	      /* Underflow (original imaginary part of x has absolute
-		 value > 2t).  */
-	      __real__ res /= exp_2t;
-	    }
-	  else
-	    __real__ res /= __ieee754_expl (2 * __imag__ x);
-	}
-      else
-	{
-	  long double sinhix, coshix;
-	  if (fabsl (__imag__ x) > LDBL_MIN)
-	    {
-	      sinhix = __ieee754_sinhl (__imag__ x);
-	      coshix = __ieee754_coshl (__imag__ x);
-	    }
-	  else
-	    {
-	      sinhix = __imag__ x;
-	      coshix = 1.0L;
-	    }
-
-	  if (fabsl (sinhix) > fabsl (cosrx) * LDBL_EPSILON)
-	    den = cosrx * cosrx + sinhix * sinhix;
-	  else
-	    den = cosrx * cosrx;
-	  __real__ res = sinrx * cosrx / den;
-	  __imag__ res = sinhix * coshix / den;
-	}
-      math_check_force_underflow_complex (res);
-    }
-
-  return res;
-}
-weak_alias (__ctanl, ctanl)
diff --git a/sysdeps/alpha/fpu/s_catanf.c b/sysdeps/alpha/fpu/s_catanf.c
index 76c1718..ee2443d 100644
--- a/sysdeps/alpha/fpu/s_catanf.c
+++ b/sysdeps/alpha/fpu/s_catanf.c
@@ -24,14 +24,18 @@
 
 #undef __catanf
 #undef catanf
-#define __catanf internal_catanf
 
 static _Complex float internal_catanf (_Complex float x);
 
-#include <math/s_catanf.c>
-#include "cfloat-compat.h"
+#define M_DECL_FUNC(f) internal_catanf
+#include <math-type-macros-float.h>
 
-#undef __catanf
+/* Disable any aliasing from base template.  */
+#undef declare_mgen_alias
+#define declare_mgen_alias(__to, __from)
+
+#include <math/s_catan_template.c>
+#include "cfloat-compat.h"
 
 c1_cfloat_rettype
 __c1_catanf (c1_cfloat_decl (x))
diff --git a/sysdeps/alpha/fpu/s_catanhf.c b/sysdeps/alpha/fpu/s_catanhf.c
index 18148dd..d9f2d21 100644
--- a/sysdeps/alpha/fpu/s_catanhf.c
+++ b/sysdeps/alpha/fpu/s_catanhf.c
@@ -24,14 +24,18 @@
 
 #undef __catanhf
 #undef catanhf
-#define __catanhf internal_catanhf
 
 static _Complex float internal_catanhf (_Complex float x);
 
-#include <math/s_catanhf.c>
-#include "cfloat-compat.h"
+#define M_DECL_FUNC(f) internal_catanhf
+#include <math-type-macros-float.h>
 
-#undef __catanhf
+/* Disable any aliasing from base template.  */
+#undef declare_mgen_alias
+#define declare_mgen_alias(__to, __from)
+
+#include <math/s_catanh_template.c>
+#include "cfloat-compat.h"
 
 c1_cfloat_rettype
 __c1_catanhf (c1_cfloat_decl (x))
diff --git a/sysdeps/alpha/fpu/s_ctanf.c b/sysdeps/alpha/fpu/s_ctanf.c
index ee02f31..cd5dd91 100644
--- a/sysdeps/alpha/fpu/s_ctanf.c
+++ b/sysdeps/alpha/fpu/s_ctanf.c
@@ -24,14 +24,18 @@
 
 #undef __ctanf
 #undef ctanf
-#define __ctanf internal_ctanf
 
 static _Complex float internal_ctanf (_Complex float x);
 
-#include <math/s_ctanf.c>
-#include "cfloat-compat.h"
+#define M_DECL_FUNC(f) internal_ctanf
+#include <math-type-macros-float.h>
 
-#undef __ctanf
+/* Disable any aliasing from base template.  */
+#undef declare_mgen_alias
+#define declare_mgen_alias(__to, __from)
+
+#include <math/s_ctan_template.c>
+#include "cfloat-compat.h"
 
 c1_cfloat_rettype
 __c1_ctanf (c1_cfloat_decl (x))
diff --git a/sysdeps/alpha/fpu/s_ctanhf.c b/sysdeps/alpha/fpu/s_ctanhf.c
index cb99279..359f053 100644
--- a/sysdeps/alpha/fpu/s_ctanhf.c
+++ b/sysdeps/alpha/fpu/s_ctanhf.c
@@ -24,14 +24,18 @@
 
 #undef __ctanhf
 #undef ctanhf
-#define __ctanhf internal_ctanhf
 
 static _Complex float internal_ctanhf (_Complex float x);
 
-#include <math/s_ctanhf.c>
-#include "cfloat-compat.h"
+#define M_DECL_FUNC(f) internal_ctanhf
+#include <math-type-macros-float.h>
 
-#undef __ctanhf
+/* Disable any aliasing from base template.  */
+#undef declare_mgen_alias
+#define declare_mgen_alias(__to, __from)
+
+#include <math/s_ctanh_template.c>
+#include "cfloat-compat.h"
 
 c1_cfloat_rettype
 __c1_ctanhf (c1_cfloat_decl (x))
diff --git a/sysdeps/ieee754/ldbl-opt/s_catan.c b/sysdeps/ieee754/ldbl-opt/s_catan.c
deleted file mode 100644
index 19f6173..0000000
--- a/sysdeps/ieee754/ldbl-opt/s_catan.c
+++ /dev/null
@@ -1,6 +0,0 @@
-#include <complex.h>
-#include <math_ldbl_opt.h>
-#include <math/s_catan.c>
-#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_1)
-compat_symbol (libm, __catan, catanl, GLIBC_2_1);
-#endif
diff --git a/sysdeps/ieee754/ldbl-opt/s_catanh.c b/sysdeps/ieee754/ldbl-opt/s_catanh.c
deleted file mode 100644
index cff7861..0000000
--- a/sysdeps/ieee754/ldbl-opt/s_catanh.c
+++ /dev/null
@@ -1,6 +0,0 @@
-#include <complex.h>
-#include <math_ldbl_opt.h>
-#include <math/s_catanh.c>
-#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_1)
-compat_symbol (libm, __catanh, catanhl, GLIBC_2_1);
-#endif
diff --git a/sysdeps/ieee754/ldbl-opt/s_catanhl.c b/sysdeps/ieee754/ldbl-opt/s_catanhl.c
deleted file mode 100644
index e956282..0000000
--- a/sysdeps/ieee754/ldbl-opt/s_catanhl.c
+++ /dev/null
@@ -1,6 +0,0 @@
-#include <complex.h>
-#include <math_ldbl_opt.h>
-#undef weak_alias
-#define weak_alias(n,a)
-#include <math/s_catanhl.c>
-long_double_symbol (libm, __catanhl, catanhl);
diff --git a/sysdeps/ieee754/ldbl-opt/s_catanl.c b/sysdeps/ieee754/ldbl-opt/s_catanl.c
deleted file mode 100644
index ee2fdf5..0000000
--- a/sysdeps/ieee754/ldbl-opt/s_catanl.c
+++ /dev/null
@@ -1,6 +0,0 @@
-#include <complex.h>
-#include <math_ldbl_opt.h>
-#undef weak_alias
-#define weak_alias(n,a)
-#include <math/s_catanl.c>
-long_double_symbol (libm, __catanl, catanl);
diff --git a/sysdeps/ieee754/ldbl-opt/s_ctan.c b/sysdeps/ieee754/ldbl-opt/s_ctan.c
deleted file mode 100644
index a6a21f9..0000000
--- a/sysdeps/ieee754/ldbl-opt/s_ctan.c
+++ /dev/null
@@ -1,6 +0,0 @@
-#include <complex.h>
-#include <math_ldbl_opt.h>
-#include <math/s_ctan.c>
-#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_1)
-compat_symbol (libm, __ctan, ctanl, GLIBC_2_1);
-#endif
diff --git a/sysdeps/ieee754/ldbl-opt/s_ctanh.c b/sysdeps/ieee754/ldbl-opt/s_ctanh.c
deleted file mode 100644
index fd4be12..0000000
--- a/sysdeps/ieee754/ldbl-opt/s_ctanh.c
+++ /dev/null
@@ -1,6 +0,0 @@
-#include <complex.h>
-#include <math_ldbl_opt.h>
-#include <math/s_ctanh.c>
-#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_1)
-compat_symbol (libm, __ctanh, ctanhl, GLIBC_2_1);
-#endif
diff --git a/sysdeps/ieee754/ldbl-opt/s_ctanhl.c b/sysdeps/ieee754/ldbl-opt/s_ctanhl.c
deleted file mode 100644
index f159373..0000000
--- a/sysdeps/ieee754/ldbl-opt/s_ctanhl.c
+++ /dev/null
@@ -1,6 +0,0 @@
-#include <complex.h>
-#include <math_ldbl_opt.h>
-#undef weak_alias
-#define weak_alias(n,a)
-#include <math/s_ctanhl.c>
-long_double_symbol (libm, __ctanhl, ctanhl);
diff --git a/sysdeps/ieee754/ldbl-opt/s_ctanl.c b/sysdeps/ieee754/ldbl-opt/s_ctanl.c
deleted file mode 100644
index 0c2d94c..0000000
--- a/sysdeps/ieee754/ldbl-opt/s_ctanl.c
+++ /dev/null
@@ -1,6 +0,0 @@
-#include <complex.h>
-#include <math_ldbl_opt.h>
-#undef weak_alias
-#define weak_alias(n,a)
-#include <math/s_ctanl.c>
-long_double_symbol (libm, __ctanl, ctanl);

http://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=f6d3a72eca7558e3c52cecc8484665399eeea626

commit f6d3a72eca7558e3c52cecc8484665399eeea626
Author: Paul E. Murphy <murphyp@linux.vnet.ibm.com>
Date:   Fri Jul 1 11:00:21 2016 -0500

    Prepare to convert _Complex tangent functions
    
    This patch has no function changes, except to
    ensure the git history correctly tracks the
    changes to convert the double version of these
    functions into a templated version.

diff --git a/ChangeLog b/ChangeLog
index 18ae1c3..4ae38e3 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,12 @@
 2016-08-19  Paul E. Murphy  <murphyp@linux.vnet.ibm.com>
 
+	* s_catan_template.c: Copy of s_catan.c.
+	* s_catanh_template.c: Copy of s_catanh.c.
+	* s_ctan_template.c: Copy of s_ctan.c.
+	* s_ctanh_template.c: Copy of s_ctanh.c.
+
+2016-08-19  Paul E. Murphy  <murphyp@linux.vnet.ibm.com>
+
 	* math/Makefile (gen-libm-calls): Move
 	casin, casinh, csin, csinh here.
 	(libm-calls): Remove the above.
diff --git a/math/s_catan_template.c b/math/s_catan_template.c
new file mode 100644
index 0000000..5ab4c0d
--- /dev/null
+++ b/math/s_catan_template.c
@@ -0,0 +1,143 @@
+/* Return arc tangent of complex double value.
+   Copyright (C) 1997-2016 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, see
+   <http://www.gnu.org/licenses/>.  */
+
+#include <complex.h>
+#include <math.h>
+#include <math_private.h>
+#include <float.h>
+
+__complex__ double
+__catan (__complex__ double x)
+{
+  __complex__ double res;
+  int rcls = fpclassify (__real__ x);
+  int icls = fpclassify (__imag__ x);
+
+  if (__glibc_unlikely (rcls <= FP_INFINITE || icls <= FP_INFINITE))
+    {
+      if (rcls == FP_INFINITE)
+	{
+	  __real__ res = __copysign (M_PI_2, __real__ x);
+	  __imag__ res = __copysign (0.0, __imag__ x);
+	}
+      else if (icls == FP_INFINITE)
+	{
+	  if (rcls >= FP_ZERO)
+	    __real__ res = __copysign (M_PI_2, __real__ x);
+	  else
+	    __real__ res = __nan ("");
+	  __imag__ res = __copysign (0.0, __imag__ x);
+	}
+      else if (icls == FP_ZERO || icls == FP_INFINITE)
+	{
+	  __real__ res = __nan ("");
+	  __imag__ res = __copysign (0.0, __imag__ x);
+	}
+      else
+	{
+	  __real__ res = __nan ("");
+	  __imag__ res = __nan ("");
+	}
+    }
+  else if (__glibc_unlikely (rcls == FP_ZERO && icls == FP_ZERO))
+    {
+      res = x;
+    }
+  else
+    {
+      if (fabs (__real__ x) >= 16.0 / DBL_EPSILON
+	  || fabs (__imag__ x) >= 16.0 / DBL_EPSILON)
+	{
+	  __real__ res = __copysign (M_PI_2, __real__ x);
+	  if (fabs (__real__ x) <= 1.0)
+	    __imag__ res = 1.0 / __imag__ x;
+	  else if (fabs (__imag__ x) <= 1.0)
+	    __imag__ res = __imag__ x / __real__ x / __real__ x;
+	  else
+	    {
+	      double h = __ieee754_hypot (__real__ x / 2.0, __imag__ x / 2.0);
+	      __imag__ res = __imag__ x / h / h / 4.0;
+	    }
+	}
+      else
+	{
+	  double den, absx, absy;
+
+	  absx = fabs (__real__ x);
+	  absy = fabs (__imag__ x);
+	  if (absx < absy)
+	    {
+	      double t = absx;
+	      absx = absy;
+	      absy = t;
+	    }
+
+	  if (absy < DBL_EPSILON / 2.0)
+	    {
+	      den = (1.0 - absx) * (1.0 + absx);
+	      if (den == -0.0)
+		den = 0.0;
+	    }
+	  else if (absx >= 1.0)
+	    den = (1.0 - absx) * (1.0 + absx) - absy * absy;
+	  else if (absx >= 0.75 || absy >= 0.5)
+	    den = -__x2y2m1 (absx, absy);
+	  else
+	    den = (1.0 - absx) * (1.0 + absx) - absy * absy;
+
+	  __real__ res = 0.5 * __ieee754_atan2 (2.0 * __real__ x, den);
+
+	  if (fabs (__imag__ x) == 1.0
+	      && fabs (__real__ x) < DBL_EPSILON * DBL_EPSILON)
+	    __imag__ res = (__copysign (0.5, __imag__ x)
+			    * (M_LN2 - __ieee754_log (fabs (__real__ x))));
+	  else
+	    {
+	      double r2 = 0.0, num, f;
+
+	      if (fabs (__real__ x) >= DBL_EPSILON * DBL_EPSILON)
+		r2 = __real__ x * __real__ x;
+
+	      num = __imag__ x + 1.0;
+	      num = r2 + num * num;
+
+	      den = __imag__ x - 1.0;
+	      den = r2 + den * den;
+
+	      f = num / den;
+	      if (f < 0.5)
+		__imag__ res = 0.25 * __ieee754_log (f);
+	      else
+		{
+		  num = 4.0 * __imag__ x;
+		  __imag__ res = 0.25 * __log1p (num / den);
+		}
+	    }
+	}
+
+      math_check_force_underflow_complex (res);
+    }
+
+  return res;
+}
+weak_alias (__catan, catan)
+#ifdef NO_LONG_DOUBLE
+strong_alias (__catan, __catanl)
+weak_alias (__catan, catanl)
+#endif
diff --git a/math/s_catanh_template.c b/math/s_catanh_template.c
new file mode 100644
index 0000000..11ea062
--- /dev/null
+++ b/math/s_catanh_template.c
@@ -0,0 +1,137 @@
+/* Return arc hyperbole tangent for double value.
+   Copyright (C) 1997-2016 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, see
+   <http://www.gnu.org/licenses/>.  */
+
+#include <complex.h>
+#include <math.h>
+#include <math_private.h>
+#include <float.h>
+
+__complex__ double
+__catanh (__complex__ double x)
+{
+  __complex__ double res;
+  int rcls = fpclassify (__real__ x);
+  int icls = fpclassify (__imag__ x);
+
+  if (__glibc_unlikely (rcls <= FP_INFINITE || icls <= FP_INFINITE))
+    {
+      if (icls == FP_INFINITE)
+	{
+	  __real__ res = __copysign (0.0, __real__ x);
+	  __imag__ res = __copysign (M_PI_2, __imag__ x);
+	}
+      else if (rcls == FP_INFINITE || rcls == FP_ZERO)
+	{
+	  __real__ res = __copysign (0.0, __real__ x);
+	  if (icls >= FP_ZERO)
+	    __imag__ res = __copysign (M_PI_2, __imag__ x);
+	  else
+	    __imag__ res = __nan ("");
+	}
+      else
+	{
+	  __real__ res = __nan ("");
+	  __imag__ res = __nan ("");
+	}
+    }
+  else if (__glibc_unlikely (rcls == FP_ZERO && icls == FP_ZERO))
+    {
+      res = x;
+    }
+  else
+    {
+      if (fabs (__real__ x) >= 16.0 / DBL_EPSILON
+	  || fabs (__imag__ x) >= 16.0 / DBL_EPSILON)
+	{
+	  __imag__ res = __copysign (M_PI_2, __imag__ x);
+	  if (fabs (__imag__ x) <= 1.0)
+	    __real__ res = 1.0 / __real__ x;
+	  else if (fabs (__real__ x) <= 1.0)
+	    __real__ res = __real__ x / __imag__ x / __imag__ x;
+	  else
+	    {
+	      double h = __ieee754_hypot (__real__ x / 2.0, __imag__ x / 2.0);
+	      __real__ res = __real__ x / h / h / 4.0;
+	    }
+	}
+      else
+	{
+	  if (fabs (__real__ x) == 1.0
+	      && fabs (__imag__ x) < DBL_EPSILON * DBL_EPSILON)
+	    __real__ res = (__copysign (0.5, __real__ x)
+			    * (M_LN2 - __ieee754_log (fabs (__imag__ x))));
+	  else
+	    {
+	      double i2 = 0.0;
+	      if (fabs (__imag__ x) >= DBL_EPSILON * DBL_EPSILON)
+		i2 = __imag__ x * __imag__ x;
+
+	      double num = 1.0 + __real__ x;
+	      num = i2 + num * num;
+
+	      double den = 1.0 - __real__ x;
+	      den = i2 + den * den;
+
+	      double f = num / den;
+	      if (f < 0.5)
+		__real__ res = 0.25 * __ieee754_log (f);
+	      else
+		{
+		  num = 4.0 * __real__ x;
+		  __real__ res = 0.25 * __log1p (num / den);
+		}
+	    }
+
+	  double absx, absy, den;
+
+	  absx = fabs (__real__ x);
+	  absy = fabs (__imag__ x);
+	  if (absx < absy)
+	    {
+	      double t = absx;
+	      absx = absy;
+	      absy = t;
+	    }
+
+	  if (absy < DBL_EPSILON / 2.0)
+	    {
+	      den = (1.0 - absx) * (1.0 + absx);
+	      if (den == -0.0)
+		den = 0.0;
+	    }
+	  else if (absx >= 1.0)
+	    den = (1.0 - absx) * (1.0 + absx) - absy * absy;
+	  else if (absx >= 0.75 || absy >= 0.5)
+	    den = -__x2y2m1 (absx, absy);
+	  else
+	    den = (1.0 - absx) * (1.0 + absx) - absy * absy;
+
+	  __imag__ res = 0.5 * __ieee754_atan2 (2.0 * __imag__ x, den);
+	}
+
+      math_check_force_underflow_complex (res);
+    }
+
+  return res;
+}
+weak_alias (__catanh, catanh)
+#ifdef NO_LONG_DOUBLE
+strong_alias (__catanh, __catanhl)
+weak_alias (__catanh, catanhl)
+#endif
diff --git a/math/s_ctan_template.c b/math/s_ctan_template.c
new file mode 100644
index 0000000..8e8bf2e
--- /dev/null
+++ b/math/s_ctan_template.c
@@ -0,0 +1,129 @@
+/* Complex tangent function for double.
+   Copyright (C) 1997-2016 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, see
+   <http://www.gnu.org/licenses/>.  */
+
+#include <complex.h>
+#include <fenv.h>
+#include <math.h>
+#include <math_private.h>
+#include <float.h>
+
+__complex__ double
+__ctan (__complex__ double x)
+{
+  __complex__ double res;
+
+  if (__glibc_unlikely (!isfinite (__real__ x) || !isfinite (__imag__ x)))
+    {
+      if (isinf (__imag__ x))
+	{
+	  if (isfinite (__real__ x) && fabs (__real__ x) > 1.0)
+	    {
+	      double sinrx, cosrx;
+	      __sincos (__real__ x, &sinrx, &cosrx);
+	      __real__ res = __copysign (0.0, sinrx * cosrx);
+	    }
+	  else
+	    __real__ res = __copysign (0.0, __real__ x);
+	  __imag__ res = __copysign (1.0, __imag__ x);
+	}
+      else if (__real__ x == 0.0)
+	{
+	  res = x;
+	}
+      else
+	{
+	  __real__ res = __nan ("");
+	  __imag__ res = __nan ("");
+
+	  if (isinf (__real__ x))
+	    feraiseexcept (FE_INVALID);
+	}
+    }
+  else
+    {
+      double sinrx, cosrx;
+      double den;
+      const int t = (int) ((DBL_MAX_EXP - 1) * M_LN2 / 2);
+
+      /* tan(x+iy) = (sin(2x) + i*sinh(2y))/(cos(2x) + cosh(2y))
+	 = (sin(x)*cos(x) + i*sinh(y)*cosh(y)/(cos(x)^2 + sinh(y)^2). */
+
+      if (__glibc_likely (fabs (__real__ x) > DBL_MIN))
+	{
+	  __sincos (__real__ x, &sinrx, &cosrx);
+	}
+      else
+	{
+	  sinrx = __real__ x;
+	  cosrx = 1.0;
+	}
+
+      if (fabs (__imag__ x) > t)
+	{
+	  /* Avoid intermediate overflow when the real part of the
+	     result may be subnormal.  Ignoring negligible terms, the
+	     imaginary part is +/- 1, the real part is
+	     sin(x)*cos(x)/sinh(y)^2 = 4*sin(x)*cos(x)/exp(2y).  */
+	  double exp_2t = __ieee754_exp (2 * t);
+
+	  __imag__ res = __copysign (1.0, __imag__ x);
+	  __real__ res = 4 * sinrx * cosrx;
+	  __imag__ x = fabs (__imag__ x);
+	  __imag__ x -= t;
+	  __real__ res /= exp_2t;
+	  if (__imag__ x > t)
+	    {
+	      /* Underflow (original imaginary part of x has absolute
+		 value > 2t).  */
+	      __real__ res /= exp_2t;
+	    }
+	  else
+	    __real__ res /= __ieee754_exp (2 * __imag__ x);
+	}
+      else
+	{
+	  double sinhix, coshix;
+	  if (fabs (__imag__ x) > DBL_MIN)
+	    {
+	      sinhix = __ieee754_sinh (__imag__ x);
+	      coshix = __ieee754_cosh (__imag__ x);
+	    }
+	  else
+	    {
+	      sinhix = __imag__ x;
+	      coshix = 1.0;
+	    }
+
+	  if (fabs (sinhix) > fabs (cosrx) * DBL_EPSILON)
+	    den = cosrx * cosrx + sinhix * sinhix;
+	  else
+	    den = cosrx * cosrx;
+	  __real__ res = sinrx * cosrx / den;
+	  __imag__ res = sinhix * coshix / den;
+	}
+      math_check_force_underflow_complex (res);
+    }
+
+  return res;
+}
+weak_alias (__ctan, ctan)
+#ifdef NO_LONG_DOUBLE
+strong_alias (__ctan, __ctanl)
+weak_alias (__ctan, ctanl)
+#endif
diff --git a/math/s_ctanh_template.c b/math/s_ctanh_template.c
new file mode 100644
index 0000000..2d18875
--- /dev/null
+++ b/math/s_ctanh_template.c
@@ -0,0 +1,129 @@
+/* Complex hyperbole tangent for double.
+   Copyright (C) 1997-2016 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, see
+   <http://www.gnu.org/licenses/>.  */
+
+#include <complex.h>
+#include <fenv.h>
+#include <math.h>
+#include <math_private.h>
+#include <float.h>
+
+__complex__ double
+__ctanh (__complex__ double x)
+{
+  __complex__ double res;
+
+  if (__glibc_unlikely (!isfinite (__real__ x) || !isfinite (__imag__ x)))
+    {
+      if (isinf (__real__ x))
+	{
+	  __real__ res = __copysign (1.0, __real__ x);
+	  if (isfinite (__imag__ x) && fabs (__imag__ x) > 1.0)
+	    {
+	      double sinix, cosix;
+	      __sincos (__imag__ x, &sinix, &cosix);
+	      __imag__ res = __copysign (0.0, sinix * cosix);
+	    }
+	  else
+	    __imag__ res = __copysign (0.0, __imag__ x);
+	}
+      else if (__imag__ x == 0.0)
+	{
+	  res = x;
+	}
+      else
+	{
+	  __real__ res = __nan ("");
+	  __imag__ res = __nan ("");
+
+	  if (isinf (__imag__ x))
+	    feraiseexcept (FE_INVALID);
+	}
+    }
+  else
+    {
+      double sinix, cosix;
+      double den;
+      const int t = (int) ((DBL_MAX_EXP - 1) * M_LN2 / 2);
+
+      /* tanh(x+iy) = (sinh(2x) + i*sin(2y))/(cosh(2x) + cos(2y))
+	 = (sinh(x)*cosh(x) + i*sin(y)*cos(y))/(sinh(x)^2 + cos(y)^2).  */
+
+      if (__glibc_likely (fabs (__imag__ x) > DBL_MIN))
+	{
+	  __sincos (__imag__ x, &sinix, &cosix);
+	}
+      else
+	{
+	  sinix = __imag__ x;
+	  cosix = 1.0;
+	}
+
+      if (fabs (__real__ x) > t)
+	{
+	  /* Avoid intermediate overflow when the imaginary part of
+	     the result may be subnormal.  Ignoring negligible terms,
+	     the real part is +/- 1, the imaginary part is
+	     sin(y)*cos(y)/sinh(x)^2 = 4*sin(y)*cos(y)/exp(2x).  */
+	  double exp_2t = __ieee754_exp (2 * t);
+
+	  __real__ res = __copysign (1.0, __real__ x);
+	  __imag__ res = 4 * sinix * cosix;
+	  __real__ x = fabs (__real__ x);
+	  __real__ x -= t;
+	  __imag__ res /= exp_2t;
+	  if (__real__ x > t)
+	    {
+	      /* Underflow (original real part of x has absolute value
+		 > 2t).  */
+	      __imag__ res /= exp_2t;
+	    }
+	  else
+	    __imag__ res /= __ieee754_exp (2 * __real__ x);
+	}
+      else
+	{
+	  double sinhrx, coshrx;
+	  if (fabs (__real__ x) > DBL_MIN)
+	    {
+	      sinhrx = __ieee754_sinh (__real__ x);
+	      coshrx = __ieee754_cosh (__real__ x);
+	    }
+	  else
+	    {
+	      sinhrx = __real__ x;
+	      coshrx = 1.0;
+	    }
+
+	  if (fabs (sinhrx) > fabs (cosix) * DBL_EPSILON)
+	    den = sinhrx * sinhrx + cosix * cosix;
+	  else
+	    den = cosix * cosix;
+	  __real__ res = sinhrx * coshrx / den;
+	  __imag__ res = sinix * cosix / den;
+	}
+      math_check_force_underflow_complex (res);
+    }
+
+  return res;
+}
+weak_alias (__ctanh, ctanh)
+#ifdef NO_LONG_DOUBLE
+strong_alias (__ctanh, __ctanhl)
+weak_alias (__ctanh, ctanhl)
+#endif

http://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=c50eee19c447d3f2c182dc3a22f2b01a053dca41

commit c50eee19c447d3f2c182dc3a22f2b01a053dca41
Author: Paul E. Murphy <murphyp@linux.vnet.ibm.com>
Date:   Tue Jun 28 08:49:23 2016 -0500

    Convert _Complex sine functions to generated code
    
    Refactor s_c{,a}sin{,h}{f,,l} into a single templated
    macro.

diff --git a/ChangeLog b/ChangeLog
index b097cd4..18ae1c3 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,57 @@
 2016-08-19  Paul E. Murphy  <murphyp@linux.vnet.ibm.com>
 
+	* math/Makefile (gen-libm-calls): Move
+	casin, casinh, csin, csinh here.
+	(libm-calls): Remove the above.
+
+	* math/s_casin_template.c: Update using type-generic macros.
+	* math/s_casinh_template.c: Likewise.
+	* math/s_csin_template.c: Likewise.
+	* math/s_csinh_template.c: Likewise.
+	* math/k_casinh_template.c: Likewise.
+
+	* math/s_casinf.c: Removed.
+	* math/s_casin.c: Removed.
+	* math/s_casinl.c: Removed.
+	* math/s_casinh.c: Removed.
+	* math/s_casinhf.c: Removed.
+	* math/s_casinhl.c: Removed.
+	* math/s_csin.c: Removed.
+	* math/s_csinf.c: Removed.
+	* math/s_csinl.c: Removed.
+	* math/s_csinh.c: Removed.
+	* math/s_csinhf.c: Removed.
+	* math/s_csinhl.c: Removed.
+	* math/k_casinh.c: Removed.
+	* math/k_casinhf.c: Removed.
+	* math/k_casinhl.c: Removed.
+
+	* sysdeps/alpha/fpu/s_casinf.c: Refactor using templated version.
+	* sysdeps/alpha/fpu/s_casinhf.c: Likewise.
+	* sysdeps/alpha/fpu/s_csinf.c: Likewise.
+	* sysdeps/alpha/fpu/s_csinhf.c: Likewise.
+
+	* sysdeps/ieee754/ldbl-opt/s_casin.c: Removed.
+	* sysdeps/ieee754/ldbl-opt/s_casinh.c: Removed.
+	* sysdeps/ieee754/ldbl-opt/s_casinhl.c: Removed.
+	* sysdeps/ieee754/ldbl-opt/s_casinl.c: Removed.
+	* sysdeps/ieee754/ldbl-opt/s_csin.c: Removed.
+	* sysdeps/ieee754/ldbl-opt/s_csinh.c: Removed.
+	* sysdeps/ieee754/ldbl-opt/s_csinhl.c: Removed.
+	* sysdeps/ieee754/ldbl-opt/s_csinl.c: Removed.
+
+	* sysdeps/m68k/m680x0/fpu/s_csin.c: Refactor into ...
+	* sysdeps/m68k/m680x0/fpu/s_csin_template.c: New file.
+	* sysdeps/m68k/m680x0/fpu/s_csinf.c: Removed.
+	* sysdeps/m68k/m680x0/fpu/s_csinl.c: Removed.
+
+	* sysdeps/m68k/m680x0/fpu/s_csinh.c: Refactor into.
+	* sysdeps/m68k/m680x0/fpu/s_csinh_template.c: New file.
+	* sysdeps/m68k/m680x0/fpu/s_csinhf.c: Removed.
+	* sysdeps/m68k/m680x0/fpu/s_csinhl.c: Removed.
+
+2016-08-19  Paul E. Murphy  <murphyp@linux.vnet.ibm.com>
+
 	* s_casin_template.c: Copy of s_casin.c.
 	* s_casinh_template.c: Copy of s_casinh.c.
 	* s_csin_template.c: Copy of s_csin.c.
diff --git a/math/Makefile b/math/Makefile
index e02b430..8873a9e 100644
--- a/math/Makefile
+++ b/math/Makefile
@@ -45,8 +45,9 @@ libm-support = s_lib_version s_matherr s_signgam			\
 
 # Wrappers for these functions generated per type using a file named
 # <func>_template.c and the appropriate math-type-macros-<TYPE>.h.
-gen-libm-calls = cargF conjF cimagF crealF cabsF s_cacosF \
-	         s_cacoshF s_ccosF s_ccoshF
+gen-libm-calls = cargF conjF cimagF crealF cabsF s_cacosF		  \
+	         s_cacoshF s_ccosF s_ccoshF s_casinF s_csinF s_casinhF	  \
+		 k_casinhF s_csinhF
 
 libm-calls =								  \
 	e_acosF e_acoshF e_asinF e_atan2F e_atanhF e_coshF e_expF e_fmodF \
@@ -64,11 +65,11 @@ libm-calls =								  \
 	w_ilogbF							  \
 	s_fpclassifyF s_fmaxF s_fminF s_fdimF s_nanF s_truncF		  \
 	s_remquoF e_log2F e_exp2F s_roundF s_nearbyintF s_sincosF	  \
-	s_cexpF s_csinhF s_clogF				  	  \
-	s_catanF s_casinF s_csinF s_ctanF s_ctanhF			  \
-	s_casinhF s_catanhF s_csqrtF s_cpowF s_cprojF s_clog10F 	  \
+	s_cexpF s_clogF							  \
+	s_catanF s_ctanF s_ctanhF					  \
+	s_catanhF s_csqrtF s_cpowF s_cprojF s_clog10F			  \
 	s_fmaF s_lrintF s_llrintF s_lroundF s_llroundF e_exp10F w_log2F	  \
-	s_issignalingF $(calls:s_%=m_%) x2y2m1F k_casinhF		  \
+	s_issignalingF $(calls:s_%=m_%) x2y2m1F				  \
 	gamma_productF lgamma_negF lgamma_productF			  \
 	s_nextupF s_nextdownF $(gen-libm-calls)
 
diff --git a/math/k_casinh.c b/math/k_casinh.c
deleted file mode 100644
index 354dde1..0000000
--- a/math/k_casinh.c
+++ /dev/null
@@ -1,210 +0,0 @@
-/* Return arc hyperbole sine for double value, with the imaginary part
-   of the result possibly adjusted for use in computing other
-   functions.
-   Copyright (C) 1997-2016 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-
-   The GNU C Library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Lesser General Public
-   License as published by the Free Software Foundation; either
-   version 2.1 of the License, or (at your option) any later version.
-
-   The GNU C Library is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Lesser General Public License for more details.
-
-   You should have received a copy of the GNU Lesser General Public
-   License along with the GNU C Library; if not, see
-   <http://www.gnu.org/licenses/>.  */
-
-#include <complex.h>
-#include <math.h>
-#include <math_private.h>
-#include <float.h>
-
-/* Return the complex inverse hyperbolic sine of finite nonzero Z,
-   with the imaginary part of the result subtracted from pi/2 if ADJ
-   is nonzero.  */
-
-__complex__ double
-__kernel_casinh (__complex__ double x, int adj)
-{
-  __complex__ double res;
-  double rx, ix;
-  __complex__ double y;
-
-  /* Avoid cancellation by reducing to the first quadrant.  */
-  rx = fabs (__real__ x);
-  ix = fabs (__imag__ x);
-
-  if (rx >= 1.0 / DBL_EPSILON || ix >= 1.0 / DBL_EPSILON)
-    {
-      /* For large x in the first quadrant, x + csqrt (1 + x * x)
-	 is sufficiently close to 2 * x to make no significant
-	 difference to the result; avoid possible overflow from
-	 the squaring and addition.  */
-      __real__ y = rx;
-      __imag__ y = ix;
-
-      if (adj)
-	{
-	  double t = __real__ y;
-	  __real__ y = __copysign (__imag__ y, __imag__ x);
-	  __imag__ y = t;
-	}
-
-      res = __clog (y);
-      __real__ res += M_LN2;
-    }
-  else if (rx >= 0.5 && ix < DBL_EPSILON / 8.0)
-    {
-      double s = __ieee754_hypot (1.0, rx);
-
-      __real__ res = __ieee754_log (rx + s);
-      if (adj)
-	__imag__ res = __ieee754_atan2 (s, __imag__ x);
-      else
-	__imag__ res = __ieee754_atan2 (ix, s);
-    }
-  else if (rx < DBL_EPSILON / 8.0 && ix >= 1.5)
-    {
-      double s = __ieee754_sqrt ((ix + 1.0) * (ix - 1.0));
-
-      __real__ res = __ieee754_log (ix + s);
-      if (adj)
-	__imag__ res = __ieee754_atan2 (rx, __copysign (s, __imag__ x));
-      else
-	__imag__ res = __ieee754_atan2 (s, rx);
-    }
-  else if (ix > 1.0 && ix < 1.5 && rx < 0.5)
-    {
-      if (rx < DBL_EPSILON * DBL_EPSILON)
-	{
-	  double ix2m1 = (ix + 1.0) * (ix - 1.0);
-	  double s = __ieee754_sqrt (ix2m1);
-
-	  __real__ res = __log1p (2.0 * (ix2m1 + ix * s)) / 2.0;
-	  if (adj)
-	    __imag__ res = __ieee754_atan2 (rx, __copysign (s, __imag__ x));
-	  else
-	    __imag__ res = __ieee754_atan2 (s, rx);
-	}
-      else
-	{
-	  double ix2m1 = (ix + 1.0) * (ix - 1.0);
-	  double rx2 = rx * rx;
-	  double f = rx2 * (2.0 + rx2 + 2.0 * ix * ix);
-	  double d = __ieee754_sqrt (ix2m1 * ix2m1 + f);
-	  double dp = d + ix2m1;
-	  double dm = f / dp;
-	  double r1 = __ieee754_sqrt ((dm + rx2) / 2.0);
-	  double r2 = rx * ix / r1;
-
-	  __real__ res = __log1p (rx2 + dp + 2.0 * (rx * r1 + ix * r2)) / 2.0;
-	  if (adj)
-	    __imag__ res = __ieee754_atan2 (rx + r1, __copysign (ix + r2,
-								 __imag__ x));
-	  else
-	    __imag__ res = __ieee754_atan2 (ix + r2, rx + r1);
-	}
-    }
-  else if (ix == 1.0 && rx < 0.5)
-    {
-      if (rx < DBL_EPSILON / 8.0)
-	{
-	  __real__ res = __log1p (2.0 * (rx + __ieee754_sqrt (rx))) / 2.0;
-	  if (adj)
-	    __imag__ res = __ieee754_atan2 (__ieee754_sqrt (rx),
-					    __copysign (1.0, __imag__ x));
-	  else
-	    __imag__ res = __ieee754_atan2 (1.0, __ieee754_sqrt (rx));
-	}
-      else
-	{
-	  double d = rx * __ieee754_sqrt (4.0 + rx * rx);
-	  double s1 = __ieee754_sqrt ((d + rx * rx) / 2.0);
-	  double s2 = __ieee754_sqrt ((d - rx * rx) / 2.0);
-
-	  __real__ res = __log1p (rx * rx + d + 2.0 * (rx * s1 + s2)) / 2.0;
-	  if (adj)
-	    __imag__ res = __ieee754_atan2 (rx + s1, __copysign (1.0 + s2,
-								 __imag__ x));
-	  else
-	    __imag__ res = __ieee754_atan2 (1.0 + s2, rx + s1);
-	}
-    }
-  else if (ix < 1.0 && rx < 0.5)
-    {
-      if (ix >= DBL_EPSILON)
-	{
-	  if (rx < DBL_EPSILON * DBL_EPSILON)
-	    {
-	      double onemix2 = (1.0 + ix) * (1.0 - ix);
-	      double s = __ieee754_sqrt (onemix2);
-
-	      __real__ res = __log1p (2.0 * rx / s) / 2.0;
-	      if (adj)
-		__imag__ res = __ieee754_atan2 (s, __imag__ x);
-	      else
-		__imag__ res = __ieee754_atan2 (ix, s);
-	    }
-	  else
-	    {
-	      double onemix2 = (1.0 + ix) * (1.0 - ix);
-	      double rx2 = rx * rx;
-	      double f = rx2 * (2.0 + rx2 + 2.0 * ix * ix);
-	      double d = __ieee754_sqrt (onemix2 * onemix2 + f);
-	      double dp = d + onemix2;
-	      double dm = f / dp;
-	      double r1 = __ieee754_sqrt ((dp + rx2) / 2.0);
-	      double r2 = rx * ix / r1;
-
-	      __real__ res
-		= __log1p (rx2 + dm + 2.0 * (rx * r1 + ix * r2)) / 2.0;
-	      if (adj)
-		__imag__ res = __ieee754_atan2 (rx + r1,
-						__copysign (ix + r2,
-							    __imag__ x));
-	      else
-		__imag__ res = __ieee754_atan2 (ix + r2, rx + r1);
-	    }
-	}
-      else
-	{
-	  double s = __ieee754_hypot (1.0, rx);
-
-	  __real__ res = __log1p (2.0 * rx * (rx + s)) / 2.0;
-	  if (adj)
-	    __imag__ res = __ieee754_atan2 (s, __imag__ x);
-	  else
-	    __imag__ res = __ieee754_atan2 (ix, s);
-	}
-      math_check_force_underflow_nonneg (__real__ res);
-    }
-  else
-    {
-      __real__ y = (rx - ix) * (rx + ix) + 1.0;
-      __imag__ y = 2.0 * rx * ix;
-
-      y = __csqrt (y);
-
-      __real__ y += rx;
-      __imag__ y += ix;
-
-      if (adj)
-	{
-	  double t = __real__ y;
-	  __real__ y = __copysign (__imag__ y, __imag__ x);
-	  __imag__ y = t;
-	}
-
-      res = __clog (y);
-    }
-
-  /* Give results the correct sign for the original argument.  */
-  __real__ res = __copysign (__real__ res, __real__ x);
-  __imag__ res = __copysign (__imag__ res, (adj ? 1.0 : __imag__ x));
-
-  return res;
-}
diff --git a/math/k_casinh_template.c b/math/k_casinh_template.c
index 354dde1..74626b1 100644
--- a/math/k_casinh_template.c
+++ b/math/k_casinh_template.c
@@ -1,6 +1,6 @@
-/* Return arc hyperbole sine for double value, with the imaginary part
-   of the result possibly adjusted for use in computing other
-   functions.
+/* Return arc hyperbolic sine for a complex float type, with the
+   imaginary part of the result possibly adjusted for use in
+   computing other functions.
    Copyright (C) 1997-2016 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
@@ -27,18 +27,18 @@
    with the imaginary part of the result subtracted from pi/2 if ADJ
    is nonzero.  */
 
-__complex__ double
-__kernel_casinh (__complex__ double x, int adj)
+CFLOAT
+M_DECL_FUNC (__kernel_casinh) (CFLOAT x, int adj)
 {
-  __complex__ double res;
-  double rx, ix;
-  __complex__ double y;
+  CFLOAT res;
+  FLOAT rx, ix;
+  CFLOAT y;
 
   /* Avoid cancellation by reducing to the first quadrant.  */
-  rx = fabs (__real__ x);
-  ix = fabs (__imag__ x);
+  rx = M_FABS (__real__ x);
+  ix = M_FABS (__imag__ x);
 
-  if (rx >= 1.0 / DBL_EPSILON || ix >= 1.0 / DBL_EPSILON)
+  if (rx >= 1 / M_EPSILON || ix >= 1 / M_EPSILON)
     {
       /* For large x in the first quadrant, x + csqrt (1 + x * x)
 	 is sufficiently close to 2 * x to make no significant
@@ -49,162 +49,157 @@ __kernel_casinh (__complex__ double x, int adj)
 
       if (adj)
 	{
-	  double t = __real__ y;
-	  __real__ y = __copysign (__imag__ y, __imag__ x);
+	  FLOAT t = __real__ y;
+	  __real__ y = M_COPYSIGN (__imag__ y, __imag__ x);
 	  __imag__ y = t;
 	}
 
-      res = __clog (y);
-      __real__ res += M_LN2;
+      res = M_SUF (__clog) (y);
+      __real__ res += (FLOAT) M_MLIT (M_LN2);
     }
-  else if (rx >= 0.5 && ix < DBL_EPSILON / 8.0)
+  else if (rx >= M_LIT (0.5) && ix < M_EPSILON / 8)
     {
-      double s = __ieee754_hypot (1.0, rx);
+      FLOAT s = M_HYPOT (1, rx);
 
-      __real__ res = __ieee754_log (rx + s);
+      __real__ res = M_LOG (rx + s);
       if (adj)
-	__imag__ res = __ieee754_atan2 (s, __imag__ x);
+	__imag__ res = M_ATAN2 (s, __imag__ x);
       else
-	__imag__ res = __ieee754_atan2 (ix, s);
+	__imag__ res = M_ATAN2 (ix, s);
     }
-  else if (rx < DBL_EPSILON / 8.0 && ix >= 1.5)
+  else if (rx < M_EPSILON / 8 && ix >= M_LIT (1.5))
     {
-      double s = __ieee754_sqrt ((ix + 1.0) * (ix - 1.0));
+      FLOAT s = M_SQRT ((ix + 1) * (ix - 1));
 
-      __real__ res = __ieee754_log (ix + s);
+      __real__ res = M_LOG (ix + s);
       if (adj)
-	__imag__ res = __ieee754_atan2 (rx, __copysign (s, __imag__ x));
+	__imag__ res = M_ATAN2 (rx, M_COPYSIGN (s, __imag__ x));
       else
-	__imag__ res = __ieee754_atan2 (s, rx);
+	__imag__ res = M_ATAN2 (s, rx);
     }
-  else if (ix > 1.0 && ix < 1.5 && rx < 0.5)
+  else if (ix > 1 && ix < M_LIT (1.5) && rx < M_LIT (0.5))
     {
-      if (rx < DBL_EPSILON * DBL_EPSILON)
+      if (rx < M_EPSILON * M_EPSILON)
 	{
-	  double ix2m1 = (ix + 1.0) * (ix - 1.0);
-	  double s = __ieee754_sqrt (ix2m1);
+	  FLOAT ix2m1 = (ix + 1) * (ix - 1);
+	  FLOAT s = M_SQRT (ix2m1);
 
-	  __real__ res = __log1p (2.0 * (ix2m1 + ix * s)) / 2.0;
+	  __real__ res = M_LOG1P (2 * (ix2m1 + ix * s)) / 2;
 	  if (adj)
-	    __imag__ res = __ieee754_atan2 (rx, __copysign (s, __imag__ x));
+	    __imag__ res = M_ATAN2 (rx, M_COPYSIGN (s, __imag__ x));
 	  else
-	    __imag__ res = __ieee754_atan2 (s, rx);
+	    __imag__ res = M_ATAN2 (s, rx);
 	}
       else
 	{
-	  double ix2m1 = (ix + 1.0) * (ix - 1.0);
-	  double rx2 = rx * rx;
-	  double f = rx2 * (2.0 + rx2 + 2.0 * ix * ix);
-	  double d = __ieee754_sqrt (ix2m1 * ix2m1 + f);
-	  double dp = d + ix2m1;
-	  double dm = f / dp;
-	  double r1 = __ieee754_sqrt ((dm + rx2) / 2.0);
-	  double r2 = rx * ix / r1;
-
-	  __real__ res = __log1p (rx2 + dp + 2.0 * (rx * r1 + ix * r2)) / 2.0;
+	  FLOAT ix2m1 = (ix + 1) * (ix - 1);
+	  FLOAT rx2 = rx * rx;
+	  FLOAT f = rx2 * (2 + rx2 + 2 * ix * ix);
+	  FLOAT d = M_SQRT (ix2m1 * ix2m1 + f);
+	  FLOAT dp = d + ix2m1;
+	  FLOAT dm = f / dp;
+	  FLOAT r1 = M_SQRT ((dm + rx2) / 2);
+	  FLOAT r2 = rx * ix / r1;
+
+	  __real__ res = M_LOG1P (rx2 + dp + 2 * (rx * r1 + ix * r2)) / 2;
 	  if (adj)
-	    __imag__ res = __ieee754_atan2 (rx + r1, __copysign (ix + r2,
-								 __imag__ x));
+	    __imag__ res = M_ATAN2 (rx + r1, M_COPYSIGN (ix + r2, __imag__ x));
 	  else
-	    __imag__ res = __ieee754_atan2 (ix + r2, rx + r1);
+	    __imag__ res = M_ATAN2 (ix + r2, rx + r1);
 	}
     }
-  else if (ix == 1.0 && rx < 0.5)
+  else if (ix == 1 && rx < M_LIT (0.5))
     {
-      if (rx < DBL_EPSILON / 8.0)
+      if (rx < M_EPSILON / 8)
 	{
-	  __real__ res = __log1p (2.0 * (rx + __ieee754_sqrt (rx))) / 2.0;
+	  __real__ res = M_LOG1P (2 * (rx + M_SQRT (rx))) / 2;
 	  if (adj)
-	    __imag__ res = __ieee754_atan2 (__ieee754_sqrt (rx),
-					    __copysign (1.0, __imag__ x));
+	    __imag__ res = M_ATAN2 (M_SQRT (rx), M_COPYSIGN (1, __imag__ x));
 	  else
-	    __imag__ res = __ieee754_atan2 (1.0, __ieee754_sqrt (rx));
+	    __imag__ res = M_ATAN2 (1, M_SQRT (rx));
 	}
       else
 	{
-	  double d = rx * __ieee754_sqrt (4.0 + rx * rx);
-	  double s1 = __ieee754_sqrt ((d + rx * rx) / 2.0);
-	  double s2 = __ieee754_sqrt ((d - rx * rx) / 2.0);
+	  FLOAT d = rx * M_SQRT (4 + rx * rx);
+	  FLOAT s1 = M_SQRT ((d + rx * rx) / 2);
+	  FLOAT s2 = M_SQRT ((d - rx * rx) / 2);
 
-	  __real__ res = __log1p (rx * rx + d + 2.0 * (rx * s1 + s2)) / 2.0;
+	  __real__ res = M_LOG1P (rx * rx + d + 2 * (rx * s1 + s2)) / 2;
 	  if (adj)
-	    __imag__ res = __ieee754_atan2 (rx + s1, __copysign (1.0 + s2,
-								 __imag__ x));
+	    __imag__ res = M_ATAN2 (rx + s1, M_COPYSIGN (1 + s2, __imag__ x));
 	  else
-	    __imag__ res = __ieee754_atan2 (1.0 + s2, rx + s1);
+	    __imag__ res = M_ATAN2 (1 + s2, rx + s1);
 	}
     }
-  else if (ix < 1.0 && rx < 0.5)
+  else if (ix < 1 && rx < M_LIT (0.5))
     {
-      if (ix >= DBL_EPSILON)
+      if (ix >= M_EPSILON)
 	{
-	  if (rx < DBL_EPSILON * DBL_EPSILON)
+	  if (rx < M_EPSILON * M_EPSILON)
 	    {
-	      double onemix2 = (1.0 + ix) * (1.0 - ix);
-	      double s = __ieee754_sqrt (onemix2);
+	      FLOAT onemix2 = (1 + ix) * (1 - ix);
+	      FLOAT s = M_SQRT (onemix2);
 
-	      __real__ res = __log1p (2.0 * rx / s) / 2.0;
+	      __real__ res = M_LOG1P (2 * rx / s) / 2;
 	      if (adj)
-		__imag__ res = __ieee754_atan2 (s, __imag__ x);
+		__imag__ res = M_ATAN2 (s, __imag__ x);
 	      else
-		__imag__ res = __ieee754_atan2 (ix, s);
+		__imag__ res = M_ATAN2 (ix, s);
 	    }
 	  else
 	    {
-	      double onemix2 = (1.0 + ix) * (1.0 - ix);
-	      double rx2 = rx * rx;
-	      double f = rx2 * (2.0 + rx2 + 2.0 * ix * ix);
-	      double d = __ieee754_sqrt (onemix2 * onemix2 + f);
-	      double dp = d + onemix2;
-	      double dm = f / dp;
-	      double r1 = __ieee754_sqrt ((dp + rx2) / 2.0);
-	      double r2 = rx * ix / r1;
-
-	      __real__ res
-		= __log1p (rx2 + dm + 2.0 * (rx * r1 + ix * r2)) / 2.0;
+	      FLOAT onemix2 = (1 + ix) * (1 - ix);
+	      FLOAT rx2 = rx * rx;
+	      FLOAT f = rx2 * (2 + rx2 + 2 * ix * ix);
+	      FLOAT d = M_SQRT (onemix2 * onemix2 + f);
+	      FLOAT dp = d + onemix2;
+	      FLOAT dm = f / dp;
+	      FLOAT r1 = M_SQRT ((dp + rx2) / 2);
+	      FLOAT r2 = rx * ix / r1;
+
+	      __real__ res = M_LOG1P (rx2 + dm + 2 * (rx * r1 + ix * r2)) / 2;
 	      if (adj)
-		__imag__ res = __ieee754_atan2 (rx + r1,
-						__copysign (ix + r2,
-							    __imag__ x));
+		__imag__ res = M_ATAN2 (rx + r1, M_COPYSIGN (ix + r2,
+							     __imag__ x));
 	      else
-		__imag__ res = __ieee754_atan2 (ix + r2, rx + r1);
+		__imag__ res = M_ATAN2 (ix + r2, rx + r1);
 	    }
 	}
       else
 	{
-	  double s = __ieee754_hypot (1.0, rx);
+	  FLOAT s = M_HYPOT (1, rx);
 
-	  __real__ res = __log1p (2.0 * rx * (rx + s)) / 2.0;
+	  __real__ res = M_LOG1P (2 * rx * (rx + s)) / 2;
 	  if (adj)
-	    __imag__ res = __ieee754_atan2 (s, __imag__ x);
+	    __imag__ res = M_ATAN2 (s, __imag__ x);
 	  else
-	    __imag__ res = __ieee754_atan2 (ix, s);
+	    __imag__ res = M_ATAN2 (ix, s);
 	}
       math_check_force_underflow_nonneg (__real__ res);
     }
   else
     {
-      __real__ y = (rx - ix) * (rx + ix) + 1.0;
-      __imag__ y = 2.0 * rx * ix;
+      __real__ y = (rx - ix) * (rx + ix) + 1;
+      __imag__ y = 2 * rx * ix;
 
-      y = __csqrt (y);
+      y = M_SUF (__csqrt) (y);
 
       __real__ y += rx;
       __imag__ y += ix;
 
       if (adj)
 	{
-	  double t = __real__ y;
-	  __real__ y = __copysign (__imag__ y, __imag__ x);
+	  FLOAT t = __real__ y;
+	  __real__ y = M_COPYSIGN (__imag__ y, __imag__ x);
 	  __imag__ y = t;
 	}
 
-      res = __clog (y);
+      res = M_SUF (__clog) (y);
     }
 
   /* Give results the correct sign for the original argument.  */
-  __real__ res = __copysign (__real__ res, __real__ x);
-  __imag__ res = __copysign (__imag__ res, (adj ? 1.0 : __imag__ x));
+  __real__ res = M_COPYSIGN (__real__ res, __real__ x);
+  __imag__ res = M_COPYSIGN (__imag__ res, (adj ? 1 : __imag__ x));
 
   return res;
 }
diff --git a/math/k_casinhf.c b/math/k_casinhf.c
deleted file mode 100644
index 7697f31..0000000
--- a/math/k_casinhf.c
+++ /dev/null
@@ -1,212 +0,0 @@
-/* Return arc hyperbole sine for float value, with the imaginary part
-   of the result possibly adjusted for use in computing other
-   functions.
-   Copyright (C) 1997-2016 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-
-   The GNU C Library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Lesser General Public
-   License as published by the Free Software Foundation; either
-   version 2.1 of the License, or (at your option) any later version.
-
-   The GNU C Library is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Lesser General Public License for more details.
-
-   You should have received a copy of the GNU Lesser General Public
-   License along with the GNU C Library; if not, see
-   <http://www.gnu.org/licenses/>.  */
-
-#include <complex.h>
-#include <math.h>
-#include <math_private.h>
-#include <float.h>
-
-/* Return the complex inverse hyperbolic sine of finite nonzero Z,
-   with the imaginary part of the result subtracted from pi/2 if ADJ
-   is nonzero.  */
-
-__complex__ float
-__kernel_casinhf (__complex__ float x, int adj)
-{
-  __complex__ float res;
-  float rx, ix;
-  __complex__ float y;
-
-  /* Avoid cancellation by reducing to the first quadrant.  */
-  rx = fabsf (__real__ x);
-  ix = fabsf (__imag__ x);
-
-  if (rx >= 1.0f / FLT_EPSILON || ix >= 1.0f / FLT_EPSILON)
-    {
-      /* For large x in the first quadrant, x + csqrt (1 + x * x)
-	 is sufficiently close to 2 * x to make no significant
-	 difference to the result; avoid possible overflow from
-	 the squaring and addition.  */
-      __real__ y = rx;
-      __imag__ y = ix;
-
-      if (adj)
-	{
-	  float t = __real__ y;
-	  __real__ y = __copysignf (__imag__ y, __imag__ x);
-	  __imag__ y = t;
-	}
-
-      res = __clogf (y);
-      __real__ res += (float) M_LN2;
-    }
-  else if (rx >= 0.5f && ix < FLT_EPSILON / 8.0f)
-    {
-      float s = __ieee754_hypotf (1.0f, rx);
-
-      __real__ res = __ieee754_logf (rx + s);
-      if (adj)
-	__imag__ res = __ieee754_atan2f (s, __imag__ x);
-      else
-	__imag__ res = __ieee754_atan2f (ix, s);
-    }
-  else if (rx < FLT_EPSILON / 8.0f && ix >= 1.5f)
-    {
-      float s = __ieee754_sqrtf ((ix + 1.0f) * (ix - 1.0f));
-
-      __real__ res = __ieee754_logf (ix + s);
-      if (adj)
-	__imag__ res = __ieee754_atan2f (rx, __copysignf (s, __imag__ x));
-      else
-	__imag__ res = __ieee754_atan2f (s, rx);
-    }
-  else if (ix > 1.0f && ix < 1.5f && rx < 0.5f)
-    {
-      if (rx < FLT_EPSILON * FLT_EPSILON)
-	{
-	  float ix2m1 = (ix + 1.0f) * (ix - 1.0f);
-	  float s = __ieee754_sqrtf (ix2m1);
-
-	  __real__ res = __log1pf (2.0f * (ix2m1 + ix * s)) / 2.0f;
-	  if (adj)
-	    __imag__ res = __ieee754_atan2f (rx, __copysignf (s, __imag__ x));
-	  else
-	    __imag__ res = __ieee754_atan2f (s, rx);
-	}
-      else
-	{
-	  float ix2m1 = (ix + 1.0f) * (ix - 1.0f);
-	  float rx2 = rx * rx;
-	  float f = rx2 * (2.0f + rx2 + 2.0f * ix * ix);
-	  float d = __ieee754_sqrtf (ix2m1 * ix2m1 + f);
-	  float dp = d + ix2m1;
-	  float dm = f / dp;
-	  float r1 = __ieee754_sqrtf ((dm + rx2) / 2.0f);
-	  float r2 = rx * ix / r1;
-
-	  __real__ res
-	    = __log1pf (rx2 + dp + 2.0f * (rx * r1 + ix * r2)) / 2.0f;
-	  if (adj)
-	    __imag__ res = __ieee754_atan2f (rx + r1, __copysignf (ix + r2,
-								   __imag__ x));
-	  else
-	    __imag__ res = __ieee754_atan2f (ix + r2, rx + r1);
-	}
-    }
-  else if (ix == 1.0f && rx < 0.5f)
-    {
-      if (rx < FLT_EPSILON / 8.0f)
-	{
-	  __real__ res = __log1pf (2.0f * (rx + __ieee754_sqrtf (rx))) / 2.0f;
-	  if (adj)
-	    __imag__ res = __ieee754_atan2f (__ieee754_sqrtf (rx),
-					     __copysignf (1.0f, __imag__ x));
-	  else
-	    __imag__ res = __ieee754_atan2f (1.0f, __ieee754_sqrtf (rx));
-	}
-      else
-	{
-	  float d = rx * __ieee754_sqrtf (4.0f + rx * rx);
-	  float s1 = __ieee754_sqrtf ((d + rx * rx) / 2.0f);
-	  float s2 = __ieee754_sqrtf ((d - rx * rx) / 2.0f);
-
-	  __real__ res = __log1pf (rx * rx + d + 2.0f * (rx * s1 + s2)) / 2.0f;
-	  if (adj)
-	    __imag__ res = __ieee754_atan2f (rx + s1,
-					     __copysignf (1.0f + s2,
-							  __imag__ x));
-	  else
-	    __imag__ res = __ieee754_atan2f (1.0f + s2, rx + s1);
-	}
-    }
-  else if (ix < 1.0f && rx < 0.5f)
-    {
-      if (ix >= FLT_EPSILON)
-	{
-	  if (rx < FLT_EPSILON * FLT_EPSILON)
-	    {
-	      float onemix2 = (1.0f + ix) * (1.0f - ix);
-	      float s = __ieee754_sqrtf (onemix2);
-
-	      __real__ res = __log1pf (2.0f * rx / s) / 2.0f;
-	      if (adj)
-		__imag__ res = __ieee754_atan2f (s, __imag__ x);
-	      else
-		__imag__ res = __ieee754_atan2f (ix, s);
-	    }
-	  else
-	    {
-	      float onemix2 = (1.0f + ix) * (1.0f - ix);
-	      float rx2 = rx * rx;
-	      float f = rx2 * (2.0f + rx2 + 2.0f * ix * ix);
-	      float d = __ieee754_sqrtf (onemix2 * onemix2 + f);
-	      float dp = d + onemix2;
-	      float dm = f / dp;
-	      float r1 = __ieee754_sqrtf ((dp + rx2) / 2.0f);
-	      float r2 = rx * ix / r1;
-
-	      __real__ res
-		= __log1pf (rx2 + dm + 2.0f * (rx * r1 + ix * r2)) / 2.0f;
-	      if (adj)
-		__imag__ res = __ieee754_atan2f (rx + r1,
-						 __copysignf (ix + r2,
-							      __imag__ x));
-	      else
-		__imag__ res = __ieee754_atan2f (ix + r2, rx + r1);
-	    }
-	}
-      else
-	{
-	  float s = __ieee754_hypotf (1.0f, rx);
-
-	  __real__ res = __log1pf (2.0f * rx * (rx + s)) / 2.0f;
-	  if (adj)
-	    __imag__ res = __ieee754_atan2f (s, __imag__ x);
-	  else
-	    __imag__ res = __ieee754_atan2f (ix, s);
-	}
-      math_check_force_underflow_nonneg (__real__ res);
-    }
-  else
-    {
-      __real__ y = (rx - ix) * (rx + ix) + 1.0f;
-      __imag__ y = 2.0f * rx * ix;
-
-      y = __csqrtf (y);
-
-      __real__ y += rx;
-      __imag__ y += ix;
-
-      if (adj)
-	{
-	  float t = __real__ y;
-	  __real__ y = __copysignf (__imag__ y, __imag__ x);
-	  __imag__ y = t;
-	}
-
-      res = __clogf (y);
-    }
-
-  /* Give results the correct sign for the original argument.  */
-  __real__ res = __copysignf (__real__ res, __real__ x);
-  __imag__ res = __copysignf (__imag__ res, (adj ? 1.0f : __imag__ x));
-
-  return res;
-}
diff --git a/math/k_casinhl.c b/math/k_casinhl.c
deleted file mode 100644
index 7c4b9c3..0000000
--- a/math/k_casinhl.c
+++ /dev/null
@@ -1,219 +0,0 @@
-/* Return arc hyperbole sine for long double value, with the imaginary
-   part of the result possibly adjusted for use in computing other
-   functions.
-   Copyright (C) 1997-2016 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-
-   The GNU C Library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Lesser General Public
-   License as published by the Free Software Foundation; either
-   version 2.1 of the License, or (at your option) any later version.
-
-   The GNU C Library is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Lesser General Public License for more details.
-
-   You should have received a copy of the GNU Lesser General Public
-   License along with the GNU C Library; if not, see
-   <http://www.gnu.org/licenses/>.  */
-
-#include <complex.h>
-#include <math.h>
-#include <math_private.h>
-#include <float.h>
-
-/* To avoid spurious overflows, use this definition to treat IBM long
-   double as approximating an IEEE-style format.  */
-#if LDBL_MANT_DIG == 106
-# undef LDBL_EPSILON
-# define LDBL_EPSILON 0x1p-106L
-#endif
-
-/* Return the complex inverse hyperbolic sine of finite nonzero Z,
-   with the imaginary part of the result subtracted from pi/2 if ADJ
-   is nonzero.  */
-
-__complex__ long double
-__kernel_casinhl (__complex__ long double x, int adj)
-{
-  __complex__ long double res;
-  long double rx, ix;
-  __complex__ long double y;
-
-  /* Avoid cancellation by reducing to the first quadrant.  */
-  rx = fabsl (__real__ x);
-  ix = fabsl (__imag__ x);
-
-  if (rx >= 1.0L / LDBL_EPSILON || ix >= 1.0L / LDBL_EPSILON)
-    {
-      /* For large x in the first quadrant, x + csqrt (1 + x * x)
-	 is sufficiently close to 2 * x to make no significant
-	 difference to the result; avoid possible overflow from
-	 the squaring and addition.  */
-      __real__ y = rx;
-      __imag__ y = ix;
-
-      if (adj)
-	{
-	  long double t = __real__ y;
-	  __real__ y = __copysignl (__imag__ y, __imag__ x);
-	  __imag__ y = t;
-	}
-
-      res = __clogl (y);
-      __real__ res += M_LN2l;
-    }
-  else if (rx >= 0.5L && ix < LDBL_EPSILON / 8.0L)
-    {
-      long double s = __ieee754_hypotl (1.0L, rx);
-
-      __real__ res = __ieee754_logl (rx + s);
-      if (adj)
-	__imag__ res = __ieee754_atan2l (s, __imag__ x);
-      else
-	__imag__ res = __ieee754_atan2l (ix, s);
-    }
-  else if (rx < LDBL_EPSILON / 8.0L && ix >= 1.5L)
-    {
-      long double s = __ieee754_sqrtl ((ix + 1.0L) * (ix - 1.0L));
-
-      __real__ res = __ieee754_logl (ix + s);
-      if (adj)
-	__imag__ res = __ieee754_atan2l (rx, __copysignl (s, __imag__ x));
-      else
-	__imag__ res = __ieee754_atan2l (s, rx);
-    }
-  else if (ix > 1.0L && ix < 1.5L && rx < 0.5L)
-    {
-      if (rx < LDBL_EPSILON * LDBL_EPSILON)
-	{
-	  long double ix2m1 = (ix + 1.0L) * (ix - 1.0L);
-	  long double s = __ieee754_sqrtl (ix2m1);
-
-	  __real__ res = __log1pl (2.0L * (ix2m1 + ix * s)) / 2.0L;
-	  if (adj)
-	    __imag__ res = __ieee754_atan2l (rx, __copysignl (s, __imag__ x));
-	  else
-	    __imag__ res = __ieee754_atan2l (s, rx);
-	}
-      else
-	{
-	  long double ix2m1 = (ix + 1.0L) * (ix - 1.0L);
-	  long double rx2 = rx * rx;
-	  long double f = rx2 * (2.0L + rx2 + 2.0L * ix * ix);
-	  long double d = __ieee754_sqrtl (ix2m1 * ix2m1 + f);
-	  long double dp = d + ix2m1;
-	  long double dm = f / dp;
-	  long double r1 = __ieee754_sqrtl ((dm + rx2) / 2.0L);
-	  long double r2 = rx * ix / r1;
-
-	  __real__ res
-	    = __log1pl (rx2 + dp + 2.0L * (rx * r1 + ix * r2)) / 2.0L;
-	  if (adj)
-	    __imag__ res = __ieee754_atan2l (rx + r1, __copysignl (ix + r2,
-								   __imag__ x));
-	  else
-	    __imag__ res = __ieee754_atan2l (ix + r2, rx + r1);
-	}
-    }
-  else if (ix == 1.0L && rx < 0.5L)
-    {
-      if (rx < LDBL_EPSILON / 8.0L)
-	{
-	  __real__ res = __log1pl (2.0L * (rx + __ieee754_sqrtl (rx))) / 2.0L;
-	  if (adj)
-	    __imag__ res = __ieee754_atan2l (__ieee754_sqrtl (rx),
-					     __copysignl (1.0L, __imag__ x));
-	  else
-	    __imag__ res = __ieee754_atan2l (1.0L, __ieee754_sqrtl (rx));
-	}
-      else
-	{
-	  long double d = rx * __ieee754_sqrtl (4.0L + rx * rx);
-	  long double s1 = __ieee754_sqrtl ((d + rx * rx) / 2.0L);
-	  long double s2 = __ieee754_sqrtl ((d - rx * rx) / 2.0L);
-
-	  __real__ res = __log1pl (rx * rx + d + 2.0L * (rx * s1 + s2)) / 2.0L;
-	  if (adj)
-	    __imag__ res = __ieee754_atan2l (rx + s1,
-					     __copysignl (1.0L + s2,
-							  __imag__ x));
-	  else
-	    __imag__ res = __ieee754_atan2l (1.0L + s2, rx + s1);
-	}
-    }
-  else if (ix < 1.0L && rx < 0.5L)
-    {
-      if (ix >= LDBL_EPSILON)
-	{
-	  if (rx < LDBL_EPSILON * LDBL_EPSILON)
-	    {
-	      long double onemix2 = (1.0L + ix) * (1.0L - ix);
-	      long double s = __ieee754_sqrtl (onemix2);
-
-	      __real__ res = __log1pl (2.0L * rx / s) / 2.0L;
-	      if (adj)
-		__imag__ res = __ieee754_atan2l (s, __imag__ x);
-	      else
-		__imag__ res = __ieee754_atan2l (ix, s);
-	    }
-	  else
-	    {
-	      long double onemix2 = (1.0L + ix) * (1.0L - ix);
-	      long double rx2 = rx * rx;
-	      long double f = rx2 * (2.0L + rx2 + 2.0L * ix * ix);
-	      long double d = __ieee754_sqrtl (onemix2 * onemix2 + f);
-	      long double dp = d + onemix2;
-	      long double dm = f / dp;
-	      long double r1 = __ieee754_sqrtl ((dp + rx2) / 2.0L);
-	      long double r2 = rx * ix / r1;
-
-	      __real__ res
-		= __log1pl (rx2 + dm + 2.0L * (rx * r1 + ix * r2)) / 2.0L;
-	      if (adj)
-		__imag__ res = __ieee754_atan2l (rx + r1,
-						 __copysignl (ix + r2,
-							      __imag__ x));
-	      else
-		__imag__ res = __ieee754_atan2l (ix + r2, rx + r1);
-	    }
-	}
-      else
-	{
-	  long double s = __ieee754_hypotl (1.0L, rx);
-
-	  __real__ res = __log1pl (2.0L * rx * (rx + s)) / 2.0L;
-	  if (adj)
-	    __imag__ res = __ieee754_atan2l (s, __imag__ x);
-	  else
-	    __imag__ res = __ieee754_atan2l (ix, s);
-	}
-      math_check_force_underflow_nonneg (__real__ res);
-    }
-  else
-    {
-      __real__ y = (rx - ix) * (rx + ix) + 1.0L;
-      __imag__ y = 2.0L * rx * ix;
-
-      y = __csqrtl (y);
-
-      __real__ y += rx;
-      __imag__ y += ix;
-
-      if (adj)
-	{
-	  long double t = __real__ y;
-	  __real__ y = __copysignl (__imag__ y, __imag__ x);
-	  __imag__ y = t;
-	}
-
-      res = __clogl (y);
-    }
-
-  /* Give results the correct sign for the original argument.  */
-  __real__ res = __copysignl (__real__ res, __real__ x);
-  __imag__ res = __copysignl (__imag__ res, (adj ? 1.0L : __imag__ x));
-
-  return res;
-}
diff --git a/math/s_casin.c b/math/s_casin.c
deleted file mode 100644
index a37933b..0000000
--- a/math/s_casin.c
+++ /dev/null
@@ -1,66 +0,0 @@
-/* Return arc sine of complex double value.
-   Copyright (C) 1997-2016 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, see
-   <http://www.gnu.org/licenses/>.  */
-
-#include <complex.h>
-#include <math.h>
-#include <math_private.h>
-
-
-__complex__ double
-__casin (__complex__ double x)
-{
-  __complex__ double res;
-
-  if (isnan (__real__ x) || isnan (__imag__ x))
-    {
-      if (__real__ x == 0.0)
-	{
-	  res = x;
-	}
-      else if (isinf (__real__ x) || isinf (__imag__ x))
-	{
-	  __real__ res = __nan ("");
-	  __imag__ res = __copysign (HUGE_VAL, __imag__ x);
-	}
-      else
-	{
-	  __real__ res = __nan ("");
-	  __imag__ res = __nan ("");
-	}
-    }
-  else
-    {
-      __complex__ double y;
-
-      __real__ y = -__imag__ x;
-      __imag__ y = __real__ x;
-
-      y = __casinh (y);
-
-      __real__ res = __imag__ y;
-      __imag__ res = -__real__ y;
-    }
-
-  return res;
-}
-weak_alias (__casin, casin)
-#ifdef NO_LONG_DOUBLE
-strong_alias (__casin, __casinl)
-weak_alias (__casin, casinl)
-#endif
diff --git a/math/s_casin_template.c b/math/s_casin_template.c
index a37933b..5b1e979 100644
--- a/math/s_casin_template.c
+++ b/math/s_casin_template.c
@@ -1,4 +1,4 @@
-/* Return arc sine of complex double value.
+/* Return arc sine of a complex float type.
    Copyright (C) 1997-2016 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
@@ -22,36 +22,36 @@
 #include <math_private.h>
 
 
-__complex__ double
-__casin (__complex__ double x)
+CFLOAT
+M_DECL_FUNC (__casin) (CFLOAT x)
 {
-  __complex__ double res;
+  CFLOAT res;
 
   if (isnan (__real__ x) || isnan (__imag__ x))
     {
-      if (__real__ x == 0.0)
+      if (__real__ x == 0)
 	{
 	  res = x;
 	}
       else if (isinf (__real__ x) || isinf (__imag__ x))
 	{
-	  __real__ res = __nan ("");
-	  __imag__ res = __copysign (HUGE_VAL, __imag__ x);
+	  __real__ res = M_NAN;
+	  __imag__ res = M_COPYSIGN (M_HUGE_VAL, __imag__ x);
 	}
       else
 	{
-	  __real__ res = __nan ("");
-	  __imag__ res = __nan ("");
+	  __real__ res = M_NAN;
+	  __imag__ res = M_NAN;
 	}
     }
   else
     {
-      __complex__ double y;
+      CFLOAT y;
 
       __real__ y = -__imag__ x;
       __imag__ y = __real__ x;
 
-      y = __casinh (y);
+      y = M_SUF (__casinh) (y);
 
       __real__ res = __imag__ y;
       __imag__ res = -__real__ y;
@@ -59,8 +59,9 @@ __casin (__complex__ double x)
 
   return res;
 }
-weak_alias (__casin, casin)
-#ifdef NO_LONG_DOUBLE
-strong_alias (__casin, __casinl)
-weak_alias (__casin, casinl)
+
+declare_mgen_alias (__casin, casin)
+
+#if M_LIBM_NEED_COMPAT (casin)
+declare_mgen_libm_compat (__casin, casin)
 #endif
diff --git a/math/s_casinf.c b/math/s_casinf.c
deleted file mode 100644
index ccb5766..0000000
--- a/math/s_casinf.c
+++ /dev/null
@@ -1,64 +0,0 @@
-/* Return arc sine of complex float value.
-   Copyright (C) 1997-2016 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, see
-   <http://www.gnu.org/licenses/>.  */
-
-#include <complex.h>
-#include <math.h>
-#include <math_private.h>
-
-
-__complex__ float
-__casinf (__complex__ float x)
-{
-  __complex__ float res;
-
-  if (isnan (__real__ x) || isnan (__imag__ x))
-    {
-      if (__real__ x == 0.0)
-	{
-	  res = x;
-	}
-      else if (isinf (__real__ x) || isinf (__imag__ x))
-	{
-	  __real__ res = __nanf ("");
-	  __imag__ res = __copysignf (HUGE_VALF, __imag__ x);
-	}
-      else
-	{
-	  __real__ res = __nanf ("");
-	  __imag__ res = __nanf ("");
-	}
-    }
-  else
-    {
-      __complex__ float y;
-
-      __real__ y = -__imag__ x;
-      __imag__ y = __real__ x;
-
-      y = __casinhf (y);
-
-      __real__ res = __imag__ y;
-      __imag__ res = -__real__ y;
-    }
-
-  return res;
-}
-#ifndef __casinf
-weak_alias (__casinf, casinf)
-#endif
diff --git a/math/s_casinh.c b/math/s_casinh.c
deleted file mode 100644
index 32cbc13..0000000
--- a/math/s_casinh.c
+++ /dev/null
@@ -1,73 +0,0 @@
-/* Return arc hyperbole sine for double value.
-   Copyright (C) 1997-2016 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, see
-   <http://www.gnu.org/licenses/>.  */
-
-#include <complex.h>
-#include <math.h>
-#include <math_private.h>
-
-__complex__ double
-__casinh (__complex__ double x)
-{
-  __complex__ double res;
-  int rcls = fpclassify (__real__ x);
-  int icls = fpclassify (__imag__ x);
-
-  if (rcls <= FP_INFINITE || icls <= FP_INFINITE)
-    {
-      if (icls == FP_INFINITE)
-	{
-	  __real__ res = __copysign (HUGE_VAL, __real__ x);
-
-	  if (rcls == FP_NAN)
-	    __imag__ res = __nan ("");
-	  else
-	    __imag__ res = __copysign (rcls >= FP_ZERO ? M_PI_2 : M_PI_4,
-				       __imag__ x);
-	}
-      else if (rcls <= FP_INFINITE)
-	{
-	  __real__ res = __real__ x;
-	  if ((rcls == FP_INFINITE && icls >= FP_ZERO)
-	      || (rcls == FP_NAN && icls == FP_ZERO))
-	    __imag__ res = __copysign (0.0, __imag__ x);
-	  else
-	    __imag__ res = __nan ("");
-	}
-      else
-	{
-	  __real__ res = __nan ("");
-	  __imag__ res = __nan ("");
-	}
-    }
-  else if (rcls == FP_ZERO && icls == FP_ZERO)
-    {
-      res = x;
-    }
-  else
-    {
-      res = __kernel_casinh (x, 0);
-    }
-
-  return res;
-}
-weak_alias (__casinh, casinh)
-#ifdef NO_LONG_DOUBLE
-strong_alias (__casinh, __casinhl)
-weak_alias (__casinh, casinhl)
-#endif
diff --git a/math/s_casinh_template.c b/math/s_casinh_template.c
index 32cbc13..fd29e63 100644
--- a/math/s_casinh_template.c
+++ b/math/s_casinh_template.c
@@ -1,4 +1,4 @@
-/* Return arc hyperbole sine for double value.
+/* Return arc hyperbolic sine for a complex float type.
    Copyright (C) 1997-2016 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
@@ -21,10 +21,10 @@
 #include <math.h>
 #include <math_private.h>
 
-__complex__ double
-__casinh (__complex__ double x)
+CFLOAT
+M_DECL_FUNC (__casinh) (CFLOAT x)
 {
-  __complex__ double res;
+  CFLOAT res;
   int rcls = fpclassify (__real__ x);
   int icls = fpclassify (__imag__ x);
 
@@ -32,12 +32,13 @@ __casinh (__complex__ double x)
     {
       if (icls == FP_INFINITE)
 	{
-	  __real__ res = __copysign (HUGE_VAL, __real__ x);
+	  __real__ res = M_COPYSIGN (M_HUGE_VAL, __real__ x);
 
 	  if (rcls == FP_NAN)
-	    __imag__ res = __nan ("");
+	    __imag__ res = M_NAN;
 	  else
-	    __imag__ res = __copysign (rcls >= FP_ZERO ? M_PI_2 : M_PI_4,
+	    __imag__ res = M_COPYSIGN ((rcls >= FP_ZERO
+				        ? M_MLIT (M_PI_2) : M_MLIT (M_PI_4)),
 				       __imag__ x);
 	}
       else if (rcls <= FP_INFINITE)
@@ -45,14 +46,14 @@ __casinh (__complex__ double x)
 	  __real__ res = __real__ x;
 	  if ((rcls == FP_INFINITE && icls >= FP_ZERO)
 	      || (rcls == FP_NAN && icls == FP_ZERO))
-	    __imag__ res = __copysign (0.0, __imag__ x);
+	    __imag__ res = M_COPYSIGN (0, __imag__ x);
 	  else
-	    __imag__ res = __nan ("");
+	    __imag__ res = M_NAN;
 	}
       else
 	{
-	  __real__ res = __nan ("");
-	  __imag__ res = __nan ("");
+	  __real__ res = M_NAN;
+	  __imag__ res = M_NAN;
 	}
     }
   else if (rcls == FP_ZERO && icls == FP_ZERO)
@@ -61,13 +62,14 @@ __casinh (__complex__ double x)
     }
   else
     {
-      res = __kernel_casinh (x, 0);
+      res = M_SUF (__kernel_casinh) (x, 0);
     }
 
   return res;
 }
-weak_alias (__casinh, casinh)
-#ifdef NO_LONG_DOUBLE
-strong_alias (__casinh, __casinhl)
-weak_alias (__casinh, casinhl)
+
+declare_mgen_alias (__casinh, casinh)
+
+#if M_LIBM_NEED_COMPAT (casinh)
+declare_mgen_libm_compat (__casinh, casinh)
 #endif
diff --git a/math/s_casinhf.c b/math/s_casinhf.c
deleted file mode 100644
index 8d08b4b..0000000
--- a/math/s_casinhf.c
+++ /dev/null
@@ -1,71 +0,0 @@
-/* Return arc hyperbole sine for float value.
-   Copyright (C) 1997-2016 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, see
-   <http://www.gnu.org/licenses/>.  */
-
-#include <complex.h>
-#include <math.h>
-#include <math_private.h>
-
-__complex__ float
-__casinhf (__complex__ float x)
-{
-  __complex__ float res;
-  int rcls = fpclassify (__real__ x);
-  int icls = fpclassify (__imag__ x);
-
-  if (rcls <= FP_INFINITE || icls <= FP_INFINITE)
-    {
-      if (icls == FP_INFINITE)
-	{
-	  __real__ res = __copysignf (HUGE_VALF, __real__ x);
-
-	  if (rcls == FP_NAN)
-	    __imag__ res = __nanf ("");
-	  else
-	    __imag__ res = __copysignf (rcls >= FP_ZERO ? M_PI_2 : M_PI_4,
-					__imag__ x);
-	}
-      else if (rcls <= FP_INFINITE)
-	{
-	  __real__ res = __real__ x;
-	  if ((rcls == FP_INFINITE && icls >= FP_ZERO)
-	      || (rcls == FP_NAN && icls == FP_ZERO))
-	    __imag__ res = __copysignf (0.0, __imag__ x);
-	  else
-	    __imag__ res = __nanf ("");
-	}
-      else
-	{
-	  __real__ res = __nanf ("");
-	  __imag__ res = __nanf ("");
-	}
-    }
-  else if (rcls == FP_ZERO && icls == FP_ZERO)
-    {
-      res = x;
-    }
-  else
-    {
-      res = __kernel_casinhf (x, 0);
-    }
-
-  return res;
-}
-#ifndef __casinhf
-weak_alias (__casinhf, casinhf)
-#endif
diff --git a/math/s_casinhl.c b/math/s_casinhl.c
deleted file mode 100644
index 81d888e..0000000
--- a/math/s_casinhl.c
+++ /dev/null
@@ -1,69 +0,0 @@
-/* Return arc hyperbole sine for long double value.
-   Copyright (C) 1997-2016 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, see
-   <http://www.gnu.org/licenses/>.  */
-
-#include <complex.h>
-#include <math.h>
-#include <math_private.h>
-
-__complex__ long double
-__casinhl (__complex__ long double x)
-{
-  __complex__ long double res;
-  int rcls = fpclassify (__real__ x);
-  int icls = fpclassify (__imag__ x);
-
-  if (rcls <= FP_INFINITE || icls <= FP_INFINITE)
-    {
-      if (icls == FP_INFINITE)
-	{
-	  __real__ res = __copysignl (HUGE_VALL, __real__ x);
-
-	  if (rcls == FP_NAN)
-	    __imag__ res = __nanl ("");
-	  else
-	    __imag__ res = __copysignl (rcls >= FP_ZERO ? M_PI_2l : M_PI_4l,
-					__imag__ x);
-	}
-      else if (rcls <= FP_INFINITE)
-	{
-	  __real__ res = __real__ x;
-	  if ((rcls == FP_INFINITE && icls >= FP_ZERO)
-	      || (rcls == FP_NAN && icls == FP_ZERO))
-	    __imag__ res = __copysignl (0.0, __imag__ x);
-	  else
-	    __imag__ res = __nanl ("");
-	}
-      else
-	{
-	  __real__ res = __nanl ("");
-	  __imag__ res = __nanl ("");
-	}
-    }
-  else if (rcls == FP_ZERO && icls == FP_ZERO)
-    {
-      res = x;
-    }
-  else
-    {
-      res = __kernel_casinhl (x, 0);
-    }
-
-  return res;
-}
-weak_alias (__casinhl, casinhl)
diff --git a/math/s_casinl.c b/math/s_casinl.c
deleted file mode 100644
index 95f25bb..0000000
--- a/math/s_casinl.c
+++ /dev/null
@@ -1,62 +0,0 @@
-/* Return arc sine of complex long double value.
-   Copyright (C) 1997-2016 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, see
-   <http://www.gnu.org/licenses/>.  */
-
-#include <complex.h>
-#include <math.h>
-#include <math_private.h>
-
-
-__complex__ long double
-__casinl (__complex__ long double x)
-{
-  __complex__ long double res;
-
-  if (isnan (__real__ x) || isnan (__imag__ x))
-    {
-      if (__real__ x == 0.0)
-	{
-	  res = x;
-	}
-      else if (isinf (__real__ x) || isinf (__imag__ x))
-	{
-	  __real__ res = __nanl ("");
-	  __imag__ res = __copysignl (HUGE_VALL, __imag__ x);
-	}
-      else
-	{
-	  __real__ res = __nanl ("");
-	  __imag__ res = __nanl ("");
-	}
-    }
-  else
-    {
-      __complex__ long double y;
-
-      __real__ y = -__imag__ x;
-      __imag__ y = __real__ x;
-
-      y = __casinhl (y);
-
-      __real__ res = __imag__ y;
-      __imag__ res = -__real__ y;
-    }
-
-  return res;
-}
-weak_alias (__casinl, casinl)
diff --git a/math/s_csin.c b/math/s_csin.c
deleted file mode 100644
index e071aa6..0000000
--- a/math/s_csin.c
+++ /dev/null
@@ -1,171 +0,0 @@
-/* Complex sine function for double.
-   Copyright (C) 1997-2016 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, see
-   <http://www.gnu.org/licenses/>.  */
-
-#include <complex.h>
-#include <fenv.h>
-#include <math.h>
-#include <math_private.h>
-#include <float.h>
-
-__complex__ double
-__csin (__complex__ double x)
-{
-  __complex__ double retval;
-  int negate = signbit (__real__ x);
-  int rcls = fpclassify (__real__ x);
-  int icls = fpclassify (__imag__ x);
-
-  __real__ x = fabs (__real__ x);
-
-  if (__glibc_likely (icls >= FP_ZERO))
-    {
-      /* Imaginary part is finite.  */
-      if (__glibc_likely (rcls >= FP_ZERO))
-	{
-	  /* Real part is finite.  */
-	  const int t = (int) ((DBL_MAX_EXP - 1) * M_LN2);
-	  double sinix, cosix;
-
-	  if (__glibc_likely (__real__ x > DBL_MIN))
-	    {
-	      __sincos (__real__ x, &sinix, &cosix);
-	    }
-	  else
-	    {
-	      sinix = __real__ x;
-	      cosix = 1.0;
-	    }
-
-	  if (negate)
-	    sinix = -sinix;
-
-	  if (fabs (__imag__ x) > t)
-	    {
-	      double exp_t = __ieee754_exp (t);
-	      double ix = fabs (__imag__ x);
-	      if (signbit (__imag__ x))
-		cosix = -cosix;
-	      ix -= t;
-	      sinix *= exp_t / 2.0;
-	      cosix *= exp_t / 2.0;
-	      if (ix > t)
-		{
-		  ix -= t;
-		  sinix *= exp_t;
-		  cosix *= exp_t;
-		}
-	      if (ix > t)
-		{
-		  /* Overflow (original imaginary part of x > 3t).  */
-		  __real__ retval = DBL_MAX * sinix;
-		  __imag__ retval = DBL_MAX * cosix;
-		}
-	      else
-		{
-		  double exp_val = __ieee754_exp (ix);
-		  __real__ retval = exp_val * sinix;
-		  __imag__ retval = exp_val * cosix;
-		}
-	    }
-	  else
-	    {
-	      __real__ retval = __ieee754_cosh (__imag__ x) * sinix;
-	      __imag__ retval = __ieee754_sinh (__imag__ x) * cosix;
-	    }
-
-	  math_check_force_underflow_complex (retval);
-	}
-      else
-	{
-	  if (icls == FP_ZERO)
-	    {
-	      /* Imaginary part is 0.0.  */
-	      __real__ retval = __nan ("");
-	      __imag__ retval = __imag__ x;
-
-	      if (rcls == FP_INFINITE)
-		feraiseexcept (FE_INVALID);
-	    }
-	  else
-	    {
-	      __real__ retval = __nan ("");
-	      __imag__ retval = __nan ("");
-
-	      feraiseexcept (FE_INVALID);
-	    }
-	}
-    }
-  else if (icls == FP_INFINITE)
-    {
-      /* Imaginary part is infinite.  */
-      if (rcls == FP_ZERO)
-	{
-	  /* Real part is 0.0.  */
-	  __real__ retval = __copysign (0.0, negate ? -1.0 : 1.0);
-	  __imag__ retval = __imag__ x;
-	}
-      else if (rcls > FP_ZERO)
-	{
-	  /* Real part is finite.  */
-	  double sinix, cosix;
-
-	  if (__glibc_likely (__real__ x > DBL_MIN))
-	    {
-	      __sincos (__real__ x, &sinix, &cosix);
-	    }
-	  else
-	    {
-	      sinix = __real__ x;
-	      cosix = 1.0;
-	    }
-
-	  __real__ retval = __copysign (HUGE_VAL, sinix);
-	  __imag__ retval = __copysign (HUGE_VAL, cosix);
-
-	  if (negate)
-	    __real__ retval = -__real__ retval;
-	  if (signbit (__imag__ x))
-	    __imag__ retval = -__imag__ retval;
-	}
-      else
-	{
-	  /* The addition raises the invalid exception.  */
-	  __real__ retval = __nan ("");
-	  __imag__ retval = HUGE_VAL;
-
-	  if (rcls == FP_INFINITE)
-	    feraiseexcept (FE_INVALID);
-	}
-    }
-  else
-    {
-      if (rcls == FP_ZERO)
-	__real__ retval = __copysign (0.0, negate ? -1.0 : 1.0);
-      else
-	__real__ retval = __nan ("");
-      __imag__ retval = __nan ("");
-    }
-
-  return retval;
-}
-weak_alias (__csin, csin)
-#ifdef NO_LONG_DOUBLE
-strong_alias (__csin, __csinl)
-weak_alias (__csin, csinl)
-#endif
diff --git a/math/s_csin_template.c b/math/s_csin_template.c
index e071aa6..59d8876 100644
--- a/math/s_csin_template.c
+++ b/math/s_csin_template.c
@@ -1,4 +1,4 @@
-/* Complex sine function for double.
+/* Complex sine function for float types.
    Copyright (C) 1997-2016 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
@@ -23,15 +23,15 @@
 #include <math_private.h>
 #include <float.h>
 
-__complex__ double
-__csin (__complex__ double x)
+CFLOAT
+M_DECL_FUNC (__csin) (CFLOAT x)
 {
-  __complex__ double retval;
+  CFLOAT retval;
   int negate = signbit (__real__ x);
   int rcls = fpclassify (__real__ x);
   int icls = fpclassify (__imag__ x);
 
-  __real__ x = fabs (__real__ x);
+  __real__ x = M_FABS (__real__ x);
 
   if (__glibc_likely (icls >= FP_ZERO))
     {
@@ -39,31 +39,31 @@ __csin (__complex__ double x)
       if (__glibc_likely (rcls >= FP_ZERO))
 	{
 	  /* Real part is finite.  */
-	  const int t = (int) ((DBL_MAX_EXP - 1) * M_LN2);
-	  double sinix, cosix;
+	  const int t = (int) ((M_MAX_EXP - 1) * M_MLIT (M_LN2));
+	  FLOAT sinix, cosix;
 
-	  if (__glibc_likely (__real__ x > DBL_MIN))
+	  if (__glibc_likely (__real__ x > M_MIN))
 	    {
-	      __sincos (__real__ x, &sinix, &cosix);
+	      M_SINCOS (__real__ x, &sinix, &cosix);
 	    }
 	  else
 	    {
 	      sinix = __real__ x;
-	      cosix = 1.0;
+	      cosix = 1;
 	    }
 
 	  if (negate)
 	    sinix = -sinix;
 
-	  if (fabs (__imag__ x) > t)
+	  if (M_FABS (__imag__ x) > t)
 	    {
-	      double exp_t = __ieee754_exp (t);
-	      double ix = fabs (__imag__ x);
+	      FLOAT exp_t = M_EXP (t);
+	      FLOAT ix = M_FABS (__imag__ x);
 	      if (signbit (__imag__ x))
 		cosix = -cosix;
 	      ix -= t;
-	      sinix *= exp_t / 2.0;
-	      cosix *= exp_t / 2.0;
+	      sinix *= exp_t / 2;
+	      cosix *= exp_t / 2;
 	      if (ix > t)
 		{
 		  ix -= t;
@@ -73,20 +73,20 @@ __csin (__complex__ double x)
 	      if (ix > t)
 		{
 		  /* Overflow (original imaginary part of x > 3t).  */
-		  __real__ retval = DBL_MAX * sinix;
-		  __imag__ retval = DBL_MAX * cosix;
+		  __real__ retval = M_MAX * sinix;
+		  __imag__ retval = M_MAX * cosix;
 		}
 	      else
 		{
-		  double exp_val = __ieee754_exp (ix);
+		  FLOAT exp_val = M_EXP (ix);
 		  __real__ retval = exp_val * sinix;
 		  __imag__ retval = exp_val * cosix;
 		}
 	    }
 	  else
 	    {
-	      __real__ retval = __ieee754_cosh (__imag__ x) * sinix;
-	      __imag__ retval = __ieee754_sinh (__imag__ x) * cosix;
+	      __real__ retval = M_COSH (__imag__ x) * sinix;
+	      __imag__ retval = M_SINH (__imag__ x) * cosix;
 	    }
 
 	  math_check_force_underflow_complex (retval);
@@ -96,7 +96,7 @@ __csin (__complex__ double x)
 	  if (icls == FP_ZERO)
 	    {
 	      /* Imaginary part is 0.0.  */
-	      __real__ retval = __nan ("");
+	      __real__ retval = M_NAN;
 	      __imag__ retval = __imag__ x;
 
 	      if (rcls == FP_INFINITE)
@@ -104,8 +104,8 @@ __csin (__complex__ double x)
 	    }
 	  else
 	    {
-	      __real__ retval = __nan ("");
-	      __imag__ retval = __nan ("");
+	      __real__ retval = M_NAN;
+	      __imag__ retval = M_NAN;
 
 	      feraiseexcept (FE_INVALID);
 	    }
@@ -117,26 +117,26 @@ __csin (__complex__ double x)
       if (rcls == FP_ZERO)
 	{
 	  /* Real part is 0.0.  */
-	  __real__ retval = __copysign (0.0, negate ? -1.0 : 1.0);
+	  __real__ retval = M_COPYSIGN (0, negate ? -1 : 1);
 	  __imag__ retval = __imag__ x;
 	}
       else if (rcls > FP_ZERO)
 	{
 	  /* Real part is finite.  */
-	  double sinix, cosix;
+	  FLOAT sinix, cosix;
 
-	  if (__glibc_likely (__real__ x > DBL_MIN))
+	  if (__glibc_likely (__real__ x > M_MIN))
 	    {
-	      __sincos (__real__ x, &sinix, &cosix);
+	      M_SINCOS (__real__ x, &sinix, &cosix);
 	    }
 	  else
 	    {
 	      sinix = __real__ x;
-	      cosix = 1.0;
+	      cosix = 1;
 	    }
 
-	  __real__ retval = __copysign (HUGE_VAL, sinix);
-	  __imag__ retval = __copysign (HUGE_VAL, cosix);
+	  __real__ retval = M_COPYSIGN (M_HUGE_VAL, sinix);
+	  __imag__ retval = M_COPYSIGN (M_HUGE_VAL, cosix);
 
 	  if (negate)
 	    __real__ retval = -__real__ retval;
@@ -146,8 +146,8 @@ __csin (__complex__ double x)
       else
 	{
 	  /* The addition raises the invalid exception.  */
-	  __real__ retval = __nan ("");
-	  __imag__ retval = HUGE_VAL;
+	  __real__ retval = M_NAN;
+	  __imag__ retval = M_HUGE_VAL;
 
 	  if (rcls == FP_INFINITE)
 	    feraiseexcept (FE_INVALID);
@@ -156,16 +156,17 @@ __csin (__complex__ double x)
   else
     {
       if (rcls == FP_ZERO)
-	__real__ retval = __copysign (0.0, negate ? -1.0 : 1.0);
+	__real__ retval = M_COPYSIGN (0, negate ? -1 : 1);
       else
-	__real__ retval = __nan ("");
-      __imag__ retval = __nan ("");
+	__real__ retval = M_NAN;
+      __imag__ retval = M_NAN;
     }
 
   return retval;
 }
-weak_alias (__csin, csin)
-#ifdef NO_LONG_DOUBLE
-strong_alias (__csin, __csinl)
-weak_alias (__csin, csinl)
+
+declare_mgen_alias (__csin, csin)
+
+#if M_LIBM_NEED_COMPAT (csin)
+declare_mgen_libm_compat (__csin, csin)
 #endif
diff --git a/math/s_csinf.c b/math/s_csinf.c
deleted file mode 100644
index 1256abc..0000000
--- a/math/s_csinf.c
+++ /dev/null
@@ -1,169 +0,0 @@
-/* Complex sine function for float.
-   Copyright (C) 1997-2016 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, see
-   <http://www.gnu.org/licenses/>.  */
-
-#include <complex.h>
-#include <fenv.h>
-#include <math.h>
-#include <math_private.h>
-#include <float.h>
-
-__complex__ float
-__csinf (__complex__ float x)
-{
-  __complex__ float retval;
-  int negate = signbit (__real__ x);
-  int rcls = fpclassify (__real__ x);
-  int icls = fpclassify (__imag__ x);
-
-  __real__ x = fabsf (__real__ x);
-
-  if (__glibc_likely (icls >= FP_ZERO))
-    {
-      /* Imaginary part is finite.  */
-      if (__glibc_likely (rcls >= FP_ZERO))
-	{
-	  /* Real part is finite.  */
-	  const int t = (int) ((FLT_MAX_EXP - 1) * M_LN2);
-	  float sinix, cosix;
-
-	  if (__glibc_likely (__real__ x > FLT_MIN))
-	    {
-	      __sincosf (__real__ x, &sinix, &cosix);
-	    }
-	  else
-	    {
-	      sinix = __real__ x;
-	      cosix = 1.0f;
-	    }
-
-	  if (negate)
-	    sinix = -sinix;
-
-	  if (fabsf (__imag__ x) > t)
-	    {
-	      float exp_t = __ieee754_expf (t);
-	      float ix = fabsf (__imag__ x);
-	      if (signbit (__imag__ x))
-		cosix = -cosix;
-	      ix -= t;
-	      sinix *= exp_t / 2.0f;
-	      cosix *= exp_t / 2.0f;
-	      if (ix > t)
-		{
-		  ix -= t;
-		  sinix *= exp_t;
-		  cosix *= exp_t;
-		}
-	      if (ix > t)
-		{
-		  /* Overflow (original imaginary part of x > 3t).  */
-		  __real__ retval = FLT_MAX * sinix;
-		  __imag__ retval = FLT_MAX * cosix;
-		}
-	      else
-		{
-		  float exp_val = __ieee754_expf (ix);
-		  __real__ retval = exp_val * sinix;
-		  __imag__ retval = exp_val * cosix;
-		}
-	    }
-	  else
-	    {
-	      __real__ retval = __ieee754_coshf (__imag__ x) * sinix;
-	      __imag__ retval = __ieee754_sinhf (__imag__ x) * cosix;
-	    }
-
-	  math_check_force_underflow_complex (retval);
-	}
-      else
-	{
-	  if (icls == FP_ZERO)
-	    {
-	      /* Imaginary part is 0.0.  */
-	      __real__ retval = __nanf ("");
-	      __imag__ retval = __imag__ x;
-
-	      if (rcls == FP_INFINITE)
-		feraiseexcept (FE_INVALID);
-	    }
-	  else
-	    {
-	      __real__ retval = __nanf ("");
-	      __imag__ retval = __nanf ("");
-
-	      feraiseexcept (FE_INVALID);
-	    }
-	}
-    }
-  else if (icls == FP_INFINITE)
-    {
-      /* Imaginary part is infinite.  */
-      if (rcls == FP_ZERO)
-	{
-	  /* Real part is 0.0.  */
-	  __real__ retval = __copysignf (0.0, negate ? -1.0 : 1.0);
-	  __imag__ retval = __imag__ x;
-	}
-      else if (rcls > FP_ZERO)
-	{
-	  /* Real part is finite.  */
-	  float sinix, cosix;
-
-	  if (__glibc_likely (__real__ x > FLT_MIN))
-	    {
-	      __sincosf (__real__ x, &sinix, &cosix);
-	    }
-	  else
-	    {
-	      sinix = __real__ x;
-	      cosix = 1.0f;
-	    }
-
-	  __real__ retval = __copysignf (HUGE_VALF, sinix);
-	  __imag__ retval = __copysignf (HUGE_VALF, cosix);
-
-	  if (negate)
-	    __real__ retval = -__real__ retval;
-	  if (signbit (__imag__ x))
-	    __imag__ retval = -__imag__ retval;
-	}
-      else
-	{
-	  /* The addition raises the invalid exception.  */
-	  __real__ retval = __nanf ("");
-	  __imag__ retval = HUGE_VALF;
-
-	  if (rcls == FP_INFINITE)
-	    feraiseexcept (FE_INVALID);
-	}
-    }
-  else
-    {
-      if (rcls == FP_ZERO)
-	__real__ retval = __copysignf (0.0, negate ? -1.0 : 1.0);
-      else
-	__real__ retval = __nanf ("");
-      __imag__ retval = __nanf ("");
-    }
-
-  return retval;
-}
-#ifndef __csinf
-weak_alias (__csinf, csinf)
-#endif
diff --git a/math/s_csinh.c b/math/s_csinh.c
deleted file mode 100644
index 5fb60ed..0000000
--- a/math/s_csinh.c
+++ /dev/null
@@ -1,166 +0,0 @@
-/* Complex sine hyperbole function for double.
-   Copyright (C) 1997-2016 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, see
-   <http://www.gnu.org/licenses/>.  */
-
-#include <complex.h>
-#include <fenv.h>
-#include <math.h>
-#include <math_private.h>
-#include <float.h>
-
-__complex__ double
-__csinh (__complex__ double x)
-{
-  __complex__ double retval;
-  int negate = signbit (__real__ x);
-  int rcls = fpclassify (__real__ x);
-  int icls = fpclassify (__imag__ x);
-
-  __real__ x = fabs (__real__ x);
-
-  if (__glibc_likely (rcls >= FP_ZERO))
-    {
-      /* Real part is finite.  */
-      if (__glibc_likely (icls >= FP_ZERO))
-	{
-	  /* Imaginary part is finite.  */
-	  const int t = (int) ((DBL_MAX_EXP - 1) * M_LN2);
-	  double sinix, cosix;
-
-	  if (__glibc_likely (fabs (__imag__ x) > DBL_MIN))
-	    {
-	      __sincos (__imag__ x, &sinix, &cosix);
-	    }
-	  else
-	    {
-	      sinix = __imag__ x;
-	      cosix = 1.0;
-	    }
-
-	  if (negate)
-	    cosix = -cosix;
-
-	  if (fabs (__real__ x) > t)
-	    {
-	      double exp_t = __ieee754_exp (t);
-	      double rx = fabs (__real__ x);
-	      if (signbit (__real__ x))
-		cosix = -cosix;
-	      rx -= t;
-	      sinix *= exp_t / 2.0;
-	      cosix *= exp_t / 2.0;
-	      if (rx > t)
-		{
-		  rx -= t;
-		  sinix *= exp_t;
-		  cosix *= exp_t;
-		}
-	      if (rx > t)
-		{
-		  /* Overflow (original real part of x > 3t).  */
-		  __real__ retval = DBL_MAX * cosix;
-		  __imag__ retval = DBL_MAX * sinix;
-		}
-	      else
-		{
-		  double exp_val = __ieee754_exp (rx);
-		  __real__ retval = exp_val * cosix;
-		  __imag__ retval = exp_val * sinix;
-		}
-	    }
-	  else
-	    {
-	      __real__ retval = __ieee754_sinh (__real__ x) * cosix;
-	      __imag__ retval = __ieee754_cosh (__real__ x) * sinix;
-	    }
-
-	  math_check_force_underflow_complex (retval);
-	}
-      else
-	{
-	  if (rcls == FP_ZERO)
-	    {
-	      /* Real part is 0.0.  */
-	      __real__ retval = __copysign (0.0, negate ? -1.0 : 1.0);
-	      __imag__ retval = __nan ("") + __nan ("");
-
-	      if (icls == FP_INFINITE)
-		feraiseexcept (FE_INVALID);
-	    }
-	  else
-	    {
-	      __real__ retval = __nan ("");
-	      __imag__ retval = __nan ("");
-
-	      feraiseexcept (FE_INVALID);
-	    }
-	}
-    }
-  else if (rcls == FP_INFINITE)
-    {
-      /* Real part is infinite.  */
-      if (__glibc_likely (icls > FP_ZERO))
-	{
-	  /* Imaginary part is finite.  */
-	  double sinix, cosix;
-
-	  if (__glibc_likely (fabs (__imag__ x) > DBL_MIN))
-	    {
-	      __sincos (__imag__ x, &sinix, &cosix);
-	    }
-	  else
-	    {
-	      sinix = __imag__ x;
-	      cosix = 1.0;
-	    }
-
-	  __real__ retval = __copysign (HUGE_VAL, cosix);
-	  __imag__ retval = __copysign (HUGE_VAL, sinix);
-
-	  if (negate)
-	    __real__ retval = -__real__ retval;
-	}
-      else if (icls == FP_ZERO)
-	{
-	  /* Imaginary part is 0.0.  */
-	  __real__ retval = negate ? -HUGE_VAL : HUGE_VAL;
-	  __imag__ retval = __imag__ x;
-	}
-      else
-	{
-	  /* The addition raises the invalid exception.  */
-	  __real__ retval = HUGE_VAL;
-	  __imag__ retval = __nan ("") + __nan ("");
-
-	  if (icls == FP_INFINITE)
-	    feraiseexcept (FE_INVALID);
-	}
-    }
-  else
-    {
-      __real__ retval = __nan ("");
-      __imag__ retval = __imag__ x == 0.0 ? __imag__ x : __nan ("");
-    }
-
-  return retval;
-}
-weak_alias (__csinh, csinh)
-#ifdef NO_LONG_DOUBLE
-strong_alias (__csinh, __csinhl)
-weak_alias (__csinh, csinhl)
-#endif
diff --git a/math/s_csinh_template.c b/math/s_csinh_template.c
index 5fb60ed..22c0c31 100644
--- a/math/s_csinh_template.c
+++ b/math/s_csinh_template.c
@@ -1,4 +1,4 @@
-/* Complex sine hyperbole function for double.
+/* Complex sine hyperbole function for float types.
    Copyright (C) 1997-2016 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
@@ -23,15 +23,15 @@
 #include <math_private.h>
 #include <float.h>
 
-__complex__ double
-__csinh (__complex__ double x)
+CFLOAT
+M_DECL_FUNC (__csinh) (CFLOAT x)
 {
-  __complex__ double retval;
+  CFLOAT retval;
   int negate = signbit (__real__ x);
   int rcls = fpclassify (__real__ x);
   int icls = fpclassify (__imag__ x);
 
-  __real__ x = fabs (__real__ x);
+  __real__ x = M_FABS (__real__ x);
 
   if (__glibc_likely (rcls >= FP_ZERO))
     {
@@ -39,31 +39,31 @@ __csinh (__complex__ double x)
       if (__glibc_likely (icls >= FP_ZERO))
 	{
 	  /* Imaginary part is finite.  */
-	  const int t = (int) ((DBL_MAX_EXP - 1) * M_LN2);
-	  double sinix, cosix;
+	  const int t = (int) ((M_MAX_EXP - 1) * M_MLIT (M_LN2));
+	  FLOAT sinix, cosix;
 
-	  if (__glibc_likely (fabs (__imag__ x) > DBL_MIN))
+	  if (__glibc_likely (M_FABS (__imag__ x) > M_MIN))
 	    {
-	      __sincos (__imag__ x, &sinix, &cosix);
+	      M_SINCOS (__imag__ x, &sinix, &cosix);
 	    }
 	  else
 	    {
 	      sinix = __imag__ x;
-	      cosix = 1.0;
+	      cosix = 1;
 	    }
 
 	  if (negate)
 	    cosix = -cosix;
 
-	  if (fabs (__real__ x) > t)
+	  if (M_FABS (__real__ x) > t)
 	    {
-	      double exp_t = __ieee754_exp (t);
-	      double rx = fabs (__real__ x);
+	      FLOAT exp_t = M_EXP (t);
+	      FLOAT rx = M_FABS (__real__ x);
 	      if (signbit (__real__ x))
 		cosix = -cosix;
 	      rx -= t;
-	      sinix *= exp_t / 2.0;
-	      cosix *= exp_t / 2.0;
+	      sinix *= exp_t / 2;
+	      cosix *= exp_t / 2;
 	      if (rx > t)
 		{
 		  rx -= t;
@@ -73,20 +73,20 @@ __csinh (__complex__ double x)
 	      if (rx > t)
 		{
 		  /* Overflow (original real part of x > 3t).  */
-		  __real__ retval = DBL_MAX * cosix;
-		  __imag__ retval = DBL_MAX * sinix;
+		  __real__ retval = M_MAX * cosix;
+		  __imag__ retval = M_MAX * sinix;
 		}
 	      else
 		{
-		  double exp_val = __ieee754_exp (rx);
+		  FLOAT exp_val = M_EXP (rx);
 		  __real__ retval = exp_val * cosix;
 		  __imag__ retval = exp_val * sinix;
 		}
 	    }
 	  else
 	    {
-	      __real__ retval = __ieee754_sinh (__real__ x) * cosix;
-	      __imag__ retval = __ieee754_cosh (__real__ x) * sinix;
+	      __real__ retval = M_SINH (__real__ x) * cosix;
+	      __imag__ retval = M_COSH (__real__ x) * sinix;
 	    }
 
 	  math_check_force_underflow_complex (retval);
@@ -96,16 +96,16 @@ __csinh (__complex__ double x)
 	  if (rcls == FP_ZERO)
 	    {
 	      /* Real part is 0.0.  */
-	      __real__ retval = __copysign (0.0, negate ? -1.0 : 1.0);
-	      __imag__ retval = __nan ("") + __nan ("");
+	      __real__ retval = M_COPYSIGN (0, negate ? -1 : 1);
+	      __imag__ retval = M_NAN + M_NAN;
 
 	      if (icls == FP_INFINITE)
 		feraiseexcept (FE_INVALID);
 	    }
 	  else
 	    {
-	      __real__ retval = __nan ("");
-	      __imag__ retval = __nan ("");
+	      __real__ retval = M_NAN;
+	      __imag__ retval = M_NAN;
 
 	      feraiseexcept (FE_INVALID);
 	    }
@@ -117,20 +117,20 @@ __csinh (__complex__ double x)
       if (__glibc_likely (icls > FP_ZERO))
 	{
 	  /* Imaginary part is finite.  */
-	  double sinix, cosix;
+	  FLOAT sinix, cosix;
 
-	  if (__glibc_likely (fabs (__imag__ x) > DBL_MIN))
+	  if (__glibc_likely (M_FABS (__imag__ x) > M_MIN))
 	    {
-	      __sincos (__imag__ x, &sinix, &cosix);
+	      M_SINCOS (__imag__ x, &sinix, &cosix);
 	    }
 	  else
 	    {
 	      sinix = __imag__ x;
-	      cosix = 1.0;
+	      cosix = 1;
 	    }
 
-	  __real__ retval = __copysign (HUGE_VAL, cosix);
-	  __imag__ retval = __copysign (HUGE_VAL, sinix);
+	  __real__ retval = M_COPYSIGN (M_HUGE_VAL, cosix);
+	  __imag__ retval = M_COPYSIGN (M_HUGE_VAL, sinix);
 
 	  if (negate)
 	    __real__ retval = -__real__ retval;
@@ -138,14 +138,14 @@ __csinh (__complex__ double x)
       else if (icls == FP_ZERO)
 	{
 	  /* Imaginary part is 0.0.  */
-	  __real__ retval = negate ? -HUGE_VAL : HUGE_VAL;
+	  __real__ retval = negate ? -M_HUGE_VAL : M_HUGE_VAL;
 	  __imag__ retval = __imag__ x;
 	}
       else
 	{
 	  /* The addition raises the invalid exception.  */
-	  __real__ retval = HUGE_VAL;
-	  __imag__ retval = __nan ("") + __nan ("");
+	  __real__ retval = M_HUGE_VAL;
+	  __imag__ retval = M_NAN + M_NAN;
 
 	  if (icls == FP_INFINITE)
 	    feraiseexcept (FE_INVALID);
@@ -153,14 +153,15 @@ __csinh (__complex__ double x)
     }
   else
     {
-      __real__ retval = __nan ("");
-      __imag__ retval = __imag__ x == 0.0 ? __imag__ x : __nan ("");
+      __real__ retval = M_NAN;
+      __imag__ retval = __imag__ x == 0 ? __imag__ x : M_NAN;
     }
 
   return retval;
 }
-weak_alias (__csinh, csinh)
-#ifdef NO_LONG_DOUBLE
-strong_alias (__csinh, __csinhl)
-weak_alias (__csinh, csinhl)
+
+declare_mgen_alias (__csinh, csinh)
+
+#if M_LIBM_NEED_COMPAT (csinh)
+declare_mgen_libm_compat (__csinh, csinh)
 #endif
diff --git a/math/s_csinhf.c b/math/s_csinhf.c
deleted file mode 100644
index 36b42ca..0000000
--- a/math/s_csinhf.c
+++ /dev/null
@@ -1,164 +0,0 @@
-/* Complex sine hyperbole function for float.
-   Copyright (C) 1997-2016 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, see
-   <http://www.gnu.org/licenses/>.  */
-
-#include <complex.h>
-#include <fenv.h>
-#include <math.h>
-#include <math_private.h>
-#include <float.h>
-
-__complex__ float
-__csinhf (__complex__ float x)
-{
-  __complex__ float retval;
-  int negate = signbit (__real__ x);
-  int rcls = fpclassify (__real__ x);
-  int icls = fpclassify (__imag__ x);
-
-  __real__ x = fabsf (__real__ x);
-
-  if (__glibc_likely (rcls >= FP_ZERO))
-    {
-      /* Real part is finite.  */
-      if (__glibc_likely (icls >= FP_ZERO))
-	{
-	  /* Imaginary part is finite.  */
-	  const int t = (int) ((FLT_MAX_EXP - 1) * M_LN2);
-	  float sinix, cosix;
-
-	  if (__glibc_likely (fabsf (__imag__ x) > FLT_MIN))
-	    {
-	      __sincosf (__imag__ x, &sinix, &cosix);
-	    }
-	  else
-	    {
-	      sinix = __imag__ x;
-	      cosix = 1.0f;
-	    }
-
-	  if (negate)
-	    cosix = -cosix;
-
-	  if (fabsf (__real__ x) > t)
-	    {
-	      float exp_t = __ieee754_expf (t);
-	      float rx = fabsf (__real__ x);
-	      if (signbit (__real__ x))
-		cosix = -cosix;
-	      rx -= t;
-	      sinix *= exp_t / 2.0f;
-	      cosix *= exp_t / 2.0f;
-	      if (rx > t)
-		{
-		  rx -= t;
-		  sinix *= exp_t;
-		  cosix *= exp_t;
-		}
-	      if (rx > t)
-		{
-		  /* Overflow (original real part of x > 3t).  */
-		  __real__ retval = FLT_MAX * cosix;
-		  __imag__ retval = FLT_MAX * sinix;
-		}
-	      else
-		{
-		  float exp_val = __ieee754_expf (rx);
-		  __real__ retval = exp_val * cosix;
-		  __imag__ retval = exp_val * sinix;
-		}
-	    }
-	  else
-	    {
-	      __real__ retval = __ieee754_sinhf (__real__ x) * cosix;
-	      __imag__ retval = __ieee754_coshf (__real__ x) * sinix;
-	    }
-
-	  math_check_force_underflow_complex (retval);
-	}
-      else
-	{
-	  if (rcls == FP_ZERO)
-	    {
-	      /* Real part is 0.0.  */
-	      __real__ retval = __copysignf (0.0, negate ? -1.0 : 1.0);
-	      __imag__ retval = __nanf ("") + __nanf ("");
-
-	      if (icls == FP_INFINITE)
-		feraiseexcept (FE_INVALID);
-	    }
-	  else
-	    {
-	      __real__ retval = __nanf ("");
-	      __imag__ retval = __nanf ("");
-
-	      feraiseexcept (FE_INVALID);
-	    }
-	}
-    }
-  else if (rcls == FP_INFINITE)
-    {
-      /* Real part is infinite.  */
-      if (__glibc_likely (icls > FP_ZERO))
-	{
-	  /* Imaginary part is finite.  */
-	  float sinix, cosix;
-
-	  if (__glibc_likely (fabsf (__imag__ x) > FLT_MIN))
-	    {
-	      __sincosf (__imag__ x, &sinix, &cosix);
-	    }
-	  else
-	    {
-	      sinix = __imag__ x;
-	      cosix = 1.0f;
-	    }
-
-	  __real__ retval = __copysignf (HUGE_VALF, cosix);
-	  __imag__ retval = __copysignf (HUGE_VALF, sinix);
-
-	  if (negate)
-	    __real__ retval = -__real__ retval;
-	}
-      else if (icls == FP_ZERO)
-	{
-	  /* Imaginary part is 0.0.  */
-	  __real__ retval = negate ? -HUGE_VALF : HUGE_VALF;
-	  __imag__ retval = __imag__ x;
-	}
-      else
-	{
-	  /* The addition raises the invalid exception.  */
-	  __real__ retval = HUGE_VALF;
-	  __imag__ retval = __nanf ("") + __nanf ("");
-
-	  if (icls == FP_INFINITE)
-	    feraiseexcept (FE_INVALID);
-	}
-    }
-  else
-    {
-      __real__ retval = __nanf ("");
-      __imag__ retval = __imag__ x == 0.0 ? __imag__ x : __nanf ("");
-    }
-
-  return retval;
-}
-#ifndef __csinhf
-weak_alias (__csinhf, csinhf)
-#endif
diff --git a/math/s_csinhl.c b/math/s_csinhl.c
deleted file mode 100644
index c231d7b..0000000
--- a/math/s_csinhl.c
+++ /dev/null
@@ -1,162 +0,0 @@
-/* Complex sine hyperbole function for long double.
-   Copyright (C) 1997-2016 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, see
-   <http://www.gnu.org/licenses/>.  */
-
-#include <complex.h>
-#include <fenv.h>
-#include <math.h>
-#include <math_private.h>
-#include <float.h>
-
-__complex__ long double
-__csinhl (__complex__ long double x)
-{
-  __complex__ long double retval;
-  int negate = signbit (__real__ x);
-  int rcls = fpclassify (__real__ x);
-  int icls = fpclassify (__imag__ x);
-
-  __real__ x = fabsl (__real__ x);
-
-  if (__glibc_likely (rcls >= FP_ZERO))
-    {
-      /* Real part is finite.  */
-      if (__glibc_likely (icls >= FP_ZERO))
-	{
-	  /* Imaginary part is finite.  */
-	  const int t = (int) ((LDBL_MAX_EXP - 1) * M_LN2l);
-	  long double sinix, cosix;
-
-	  if (__glibc_likely (fabsl (__imag__ x) > LDBL_MIN))
-	    {
-	      __sincosl (__imag__ x, &sinix, &cosix);
-	    }
-	  else
-	    {
-	      sinix = __imag__ x;
-	      cosix = 1.0;
-	    }
-
-	  if (negate)
-	    cosix = -cosix;
-
-	  if (fabsl (__real__ x) > t)
-	    {
-	      long double exp_t = __ieee754_expl (t);
-	      long double rx = fabsl (__real__ x);
-	      if (signbit (__real__ x))
-		cosix = -cosix;
-	      rx -= t;
-	      sinix *= exp_t / 2.0L;
-	      cosix *= exp_t / 2.0L;
-	      if (rx > t)
-		{
-		  rx -= t;
-		  sinix *= exp_t;
-		  cosix *= exp_t;
-		}
-	      if (rx > t)
-		{
-		  /* Overflow (original real part of x > 3t).  */
-		  __real__ retval = LDBL_MAX * cosix;
-		  __imag__ retval = LDBL_MAX * sinix;
-		}
-	      else
-		{
-		  long double exp_val = __ieee754_expl (rx);
-		  __real__ retval = exp_val * cosix;
-		  __imag__ retval = exp_val * sinix;
-		}
-	    }
-	  else
-	    {
-	      __real__ retval = __ieee754_sinhl (__real__ x) * cosix;
-	      __imag__ retval = __ieee754_coshl (__real__ x) * sinix;
-	    }
-
-	  math_check_force_underflow_complex (retval);
-	}
-      else
-	{
-	  if (rcls == FP_ZERO)
-	    {
-	      /* Real part is 0.0.  */
-	      __real__ retval = __copysignl (0.0, negate ? -1.0 : 1.0);
-	      __imag__ retval = __nanl ("") + __nanl ("");
-
-	      if (icls == FP_INFINITE)
-		feraiseexcept (FE_INVALID);
-	    }
-	  else
-	    {
-	      __real__ retval = __nanl ("");
-	      __imag__ retval = __nanl ("");
-
-	      feraiseexcept (FE_INVALID);
-	    }
-	}
-    }
-  else if (rcls == FP_INFINITE)
-    {
-      /* Real part is infinite.  */
-      if (__glibc_likely (icls > FP_ZERO))
-	{
-	  /* Imaginary part is finite.  */
-	  long double sinix, cosix;
-
-	  if (__glibc_likely (fabsl (__imag__ x) > LDBL_MIN))
-	    {
-	      __sincosl (__imag__ x, &sinix, &cosix);
-	    }
-	  else
-	    {
-	      sinix = __imag__ x;
-	      cosix = 1.0;
-	    }
-
-	  __real__ retval = __copysignl (HUGE_VALL, cosix);
-	  __imag__ retval = __copysignl (HUGE_VALL, sinix);
-
-	  if (negate)
-	    __real__ retval = -__real__ retval;
-	}
-      else if (icls == FP_ZERO)
-	{
-	  /* Imaginary part is 0.0.  */
-	  __real__ retval = negate ? -HUGE_VALL : HUGE_VALL;
-	  __imag__ retval = __imag__ x;
-	}
-      else
-	{
-	  /* The addition raises the invalid exception.  */
-	  __real__ retval = HUGE_VALL;
-	  __imag__ retval = __nanl ("") + __nanl ("");
-
-	  if (icls == FP_INFINITE)
-	    feraiseexcept (FE_INVALID);
-	}
-    }
-  else
-    {
-      __real__ retval = __nanl ("");
-      __imag__ retval = __imag__ x == 0.0 ? __imag__ x : __nanl ("");
-    }
-
-  return retval;
-}
-weak_alias (__csinhl, csinhl)
diff --git a/math/s_csinl.c b/math/s_csinl.c
deleted file mode 100644
index 9742a31..0000000
--- a/math/s_csinl.c
+++ /dev/null
@@ -1,167 +0,0 @@
-/* Complex sine function for long double.
-   Copyright (C) 1997-2016 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, see
-   <http://www.gnu.org/licenses/>.  */
-
-#include <complex.h>
-#include <fenv.h>
-#include <math.h>
-#include <math_private.h>
-#include <float.h>
-
-__complex__ long double
-__csinl (__complex__ long double x)
-{
-  __complex__ long double retval;
-  int negate = signbit (__real__ x);
-  int rcls = fpclassify (__real__ x);
-  int icls = fpclassify (__imag__ x);
-
-  __real__ x = fabsl (__real__ x);
-
-  if (__glibc_likely (icls >= FP_ZERO))
-    {
-      /* Imaginary part is finite.  */
-      if (__glibc_likely (rcls >= FP_ZERO))
-	{
-	  /* Real part is finite.  */
-	  const int t = (int) ((LDBL_MAX_EXP - 1) * M_LN2l);
-	  long double sinix, cosix;
-
-	  if (__glibc_likely (__real__ x > LDBL_MIN))
-	    {
-	      __sincosl (__real__ x, &sinix, &cosix);
-	    }
-	  else
-	    {
-	      sinix = __real__ x;
-	      cosix = 1.0;
-	    }
-
-	  if (negate)
-	    sinix = -sinix;
-
-	  if (fabsl (__imag__ x) > t)
-	    {
-	      long double exp_t = __ieee754_expl (t);
-	      long double ix = fabsl (__imag__ x);
-	      if (signbit (__imag__ x))
-		cosix = -cosix;
-	      ix -= t;
-	      sinix *= exp_t / 2.0L;
-	      cosix *= exp_t / 2.0L;
-	      if (ix > t)
-		{
-		  ix -= t;
-		  sinix *= exp_t;
-		  cosix *= exp_t;
-		}
-	      if (ix > t)
-		{
-		  /* Overflow (original imaginary part of x > 3t).  */
-		  __real__ retval = LDBL_MAX * sinix;
-		  __imag__ retval = LDBL_MAX * cosix;
-		}
-	      else
-		{
-		  long double exp_val = __ieee754_expl (ix);
-		  __real__ retval = exp_val * sinix;
-		  __imag__ retval = exp_val * cosix;
-		}
-	    }
-	  else
-	    {
-	      __real__ retval = __ieee754_coshl (__imag__ x) * sinix;
-	      __imag__ retval = __ieee754_sinhl (__imag__ x) * cosix;
-	    }
-
-	  math_check_force_underflow_complex (retval);
-	}
-      else
-	{
-	  if (icls == FP_ZERO)
-	    {
-	      /* Imaginary part is 0.0.  */
-	      __real__ retval = __nanl ("");
-	      __imag__ retval = __imag__ x;
-
-	      if (rcls == FP_INFINITE)
-		feraiseexcept (FE_INVALID);
-	    }
-	  else
-	    {
-	      __real__ retval = __nanl ("");
-	      __imag__ retval = __nanl ("");
-
-	      feraiseexcept (FE_INVALID);
-	    }
-	}
-    }
-  else if (icls == FP_INFINITE)
-    {
-      /* Imaginary part is infinite.  */
-      if (rcls == FP_ZERO)
-	{
-	  /* Real part is 0.0.  */
-	  __real__ retval = __copysignl (0.0, negate ? -1.0 : 1.0);
-	  __imag__ retval = __imag__ x;
-	}
-      else if (rcls > FP_ZERO)
-	{
-	  /* Real part is finite.  */
-	  long double sinix, cosix;
-
-	  if (__glibc_likely (__real__ x > LDBL_MIN))
-	    {
-	      __sincosl (__real__ x, &sinix, &cosix);
-	    }
-	  else
-	    {
-	      sinix = __real__ x;
-	      cosix = 1.0;
-	    }
-
-	  __real__ retval = __copysignl (HUGE_VALL, sinix);
-	  __imag__ retval = __copysignl (HUGE_VALL, cosix);
-
-	  if (negate)
-	    __real__ retval = -__real__ retval;
-	  if (signbit (__imag__ x))
-	    __imag__ retval = -__imag__ retval;
-	}
-      else
-	{
-	  /* The addition raises the invalid exception.  */
-	  __real__ retval = __nanl ("");
-	  __imag__ retval = HUGE_VALL;
-
-	  if (rcls == FP_INFINITE)
-	    feraiseexcept (FE_INVALID);
-	}
-    }
-  else
-    {
-      if (rcls == FP_ZERO)
-	__real__ retval = __copysignl (0.0, negate ? -1.0 : 1.0);
-      else
-	__real__ retval = __nanl ("");
-      __imag__ retval = __nanl ("");
-    }
-
-  return retval;
-}
-weak_alias (__csinl, csinl)
diff --git a/sysdeps/alpha/fpu/s_casinf.c b/sysdeps/alpha/fpu/s_casinf.c
index f85f524..08d0a6d 100644
--- a/sysdeps/alpha/fpu/s_casinf.c
+++ b/sysdeps/alpha/fpu/s_casinf.c
@@ -24,14 +24,18 @@
 
 #undef __casinf
 #undef casinf
-#define __casinf internal_casinf
 
 static _Complex float internal_casinf (_Complex float x);
 
-#include <math/s_casinf.c>
-#include "cfloat-compat.h"
+#define M_DECL_FUNC(f) internal_casinf
+#include <math-type-macros-float.h>
 
-#undef __casinf
+/* Disable any aliasing from base template.  */
+#undef declare_mgen_alias
+#define declare_mgen_alias(__to, __from)
+
+#include <math/s_casin_template.c>
+#include "cfloat-compat.h"
 
 c1_cfloat_rettype
 __c1_casinf (c1_cfloat_decl (x))
diff --git a/sysdeps/alpha/fpu/s_casinhf.c b/sysdeps/alpha/fpu/s_casinhf.c
index 720294e..11faf9a 100644
--- a/sysdeps/alpha/fpu/s_casinhf.c
+++ b/sysdeps/alpha/fpu/s_casinhf.c
@@ -24,14 +24,18 @@
 
 #undef __casinhf
 #undef casinhf
-#define __casinhf internal_casinhf
 
 static _Complex float internal_casinhf (_Complex float x);
 
-#include <math/s_casinhf.c>
-#include "cfloat-compat.h"
+#define M_DECL_FUNC(f) internal_casinhf
+#include <math-type-macros-float.h>
 
-#undef __casinhf
+/* Disable any aliasing from base template.  */
+#undef declare_mgen_alias
+#define declare_mgen_alias(__to, __from)
+
+#include <math/s_casinh_template.c>
+#include "cfloat-compat.h"
 
 c1_cfloat_rettype
 __c1_casinhf (c1_cfloat_decl (x))
diff --git a/sysdeps/alpha/fpu/s_csinf.c b/sysdeps/alpha/fpu/s_csinf.c
index abe2d3a..fc49244 100644
--- a/sysdeps/alpha/fpu/s_csinf.c
+++ b/sysdeps/alpha/fpu/s_csinf.c
@@ -24,14 +24,18 @@
 
 #undef __csinf
 #undef csinf
-#define __csinf internal_csinf
 
 static _Complex float internal_csinf (_Complex float x);
 
-#include <math/s_csinf.c>
-#include "cfloat-compat.h"
+#define M_DECL_FUNC(f) internal_csinf
+#include <math-type-macros-float.h>
 
-#undef __csinf
+/* Disable any aliasing from base template.  */
+#undef declare_mgen_alias
+#define declare_mgen_alias(__to, __from)
+
+#include <math/s_csin_template.c>
+#include "cfloat-compat.h"
 
 c1_cfloat_rettype
 __c1_csinf (c1_cfloat_decl (x))
diff --git a/sysdeps/alpha/fpu/s_csinhf.c b/sysdeps/alpha/fpu/s_csinhf.c
index a6d470a..6263cd0 100644
--- a/sysdeps/alpha/fpu/s_csinhf.c
+++ b/sysdeps/alpha/fpu/s_csinhf.c
@@ -24,14 +24,18 @@
 
 #undef __csinhf
 #undef csinhf
-#define __csinhf internal_csinhf
 
 static _Complex float internal_csinhf (_Complex float x);
 
-#include <math/s_csinhf.c>
-#include "cfloat-compat.h"
+#define M_DECL_FUNC(f) internal_csinhf
+#include <math-type-macros-float.h>
 
-#undef __csinhf
+/* Disable any aliasing from base template.  */
+#undef declare_mgen_alias
+#define declare_mgen_alias(__to, __from)
+
+#include <math/s_csinh_template.c>
+#include "cfloat-compat.h"
 
 c1_cfloat_rettype
 __c1_csinhf (c1_cfloat_decl (x))
diff --git a/sysdeps/ieee754/ldbl-opt/s_casin.c b/sysdeps/ieee754/ldbl-opt/s_casin.c
deleted file mode 100644
index 04c47ca..0000000
--- a/sysdeps/ieee754/ldbl-opt/s_casin.c
+++ /dev/null
@@ -1,6 +0,0 @@
-#include <complex.h>
-#include <math_ldbl_opt.h>
-#include <math/s_casin.c>
-#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_1)
-compat_symbol (libm, __casin, casinl, GLIBC_2_1);
-#endif
diff --git a/sysdeps/ieee754/ldbl-opt/s_casinh.c b/sysdeps/ieee754/ldbl-opt/s_casinh.c
deleted file mode 100644
index 19c4fa3..0000000
--- a/sysdeps/ieee754/ldbl-opt/s_casinh.c
+++ /dev/null
@@ -1,6 +0,0 @@
-#include <complex.h>
-#include <math_ldbl_opt.h>
-#include <math/s_casinh.c>
-#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_1)
-compat_symbol (libm, __casinh, casinhl, GLIBC_2_1);
-#endif
diff --git a/sysdeps/ieee754/ldbl-opt/s_casinhl.c b/sysdeps/ieee754/ldbl-opt/s_casinhl.c
deleted file mode 100644
index 976fa8e..0000000
--- a/sysdeps/ieee754/ldbl-opt/s_casinhl.c
+++ /dev/null
@@ -1,6 +0,0 @@
-#include <complex.h>
-#include <math_ldbl_opt.h>
-#undef weak_alias
-#define weak_alias(n,a)
-#include <math/s_casinhl.c>
-long_double_symbol (libm, __casinhl, casinhl);
diff --git a/sysdeps/ieee754/ldbl-opt/s_casinl.c b/sysdeps/ieee754/ldbl-opt/s_casinl.c
deleted file mode 100644
index 7afb77c..0000000
--- a/sysdeps/ieee754/ldbl-opt/s_casinl.c
+++ /dev/null
@@ -1,6 +0,0 @@
-#include <complex.h>
-#include <math_ldbl_opt.h>
-#undef weak_alias
-#define weak_alias(n,a)
-#include <math/s_casinl.c>
-long_double_symbol (libm, __casinl, casinl);
diff --git a/sysdeps/ieee754/ldbl-opt/s_csin.c b/sysdeps/ieee754/ldbl-opt/s_csin.c
deleted file mode 100644
index 7017c95..0000000
--- a/sysdeps/ieee754/ldbl-opt/s_csin.c
+++ /dev/null
@@ -1,6 +0,0 @@
-#include <complex.h>
-#include <math_ldbl_opt.h>
-#include <math/s_csin.c>
-#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_1)
-compat_symbol (libm, __csin, csinl, GLIBC_2_1);
-#endif
diff --git a/sysdeps/ieee754/ldbl-opt/s_csinh.c b/sysdeps/ieee754/ldbl-opt/s_csinh.c
deleted file mode 100644
index a1fa667..0000000
--- a/sysdeps/ieee754/ldbl-opt/s_csinh.c
+++ /dev/null
@@ -1,6 +0,0 @@
-#include <complex.h>
-#include <math_ldbl_opt.h>
-#include <math/s_csinh.c>
-#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_1)
-compat_symbol (libm, __csinh, csinhl, GLIBC_2_1);
-#endif
diff --git a/sysdeps/ieee754/ldbl-opt/s_csinhl.c b/sysdeps/ieee754/ldbl-opt/s_csinhl.c
deleted file mode 100644
index 484d466..0000000
--- a/sysdeps/ieee754/ldbl-opt/s_csinhl.c
+++ /dev/null
@@ -1,6 +0,0 @@
-#include <complex.h>
-#include <math_ldbl_opt.h>
-#undef weak_alias
-#define weak_alias(n,a)
-#include <math/s_csinhl.c>
-long_double_symbol (libm, __csinhl, csinhl);
diff --git a/sysdeps/ieee754/ldbl-opt/s_csinl.c b/sysdeps/ieee754/ldbl-opt/s_csinl.c
deleted file mode 100644
index f71642e..0000000
--- a/sysdeps/ieee754/ldbl-opt/s_csinl.c
+++ /dev/null
@@ -1,6 +0,0 @@
-#include <complex.h>
-#include <math_ldbl_opt.h>
-#undef weak_alias
-#define weak_alias(n,a)
-#include <math/s_csinl.c>
-long_double_symbol (libm, __csinl, csinl);
diff --git a/sysdeps/m68k/m680x0/fpu/s_csin.c b/sysdeps/m68k/m680x0/fpu/s_csin_template.c
similarity index 86%
rename from sysdeps/m68k/m680x0/fpu/s_csin.c
rename to sysdeps/m68k/m680x0/fpu/s_csin_template.c
index b8419be..628d0d5 100644
--- a/sysdeps/m68k/m680x0/fpu/s_csin.c
+++ b/sysdeps/m68k/m680x0/fpu/s_csin_template.c
@@ -21,27 +21,19 @@
 #include <math.h>
 #include "mathimpl.h"
 
-#ifndef SUFF
-#define SUFF
-#endif
-#ifndef float_type
-#define float_type double
-#endif
-
-#define CONCATX(a,b) __CONCAT(a,b)
-#define s(name) CONCATX(name,SUFF)
+#define s(name) M_SUF (name)
 #define m81(func) __m81_u(s(func))
 
-__complex__ float_type
-s(__csin) (__complex__ float_type x)
+CFLOAT
+s(__csin) (CFLOAT x)
 {
-  __complex__ float_type retval;
+  CFLOAT retval;
   unsigned long rx_cond = __m81_test (__real__ x);
 
   if ((rx_cond & (__M81_COND_INF|__M81_COND_NAN)) == 0)
     {
       /* Real part is finite.  */
-      float_type sin_rx, cos_rx;
+      FLOAT sin_rx, cos_rx;
 
       __asm ("fsincos%.x %2,%1:%0" : "=f" (sin_rx), "=f" (cos_rx)
 	     : "f" (__real__ x));
diff --git a/sysdeps/m68k/m680x0/fpu/s_csinf.c b/sysdeps/m68k/m680x0/fpu/s_csinf.c
deleted file mode 100644
index b760e19..0000000
--- a/sysdeps/m68k/m680x0/fpu/s_csinf.c
+++ /dev/null
@@ -1,3 +0,0 @@
-#define SUFF f
-#define float_type float
-#include <s_csin.c>
diff --git a/sysdeps/m68k/m680x0/fpu/s_csinh.c b/sysdeps/m68k/m680x0/fpu/s_csinh_template.c
similarity index 88%
rename from sysdeps/m68k/m680x0/fpu/s_csinh.c
rename to sysdeps/m68k/m680x0/fpu/s_csinh_template.c
index c633cd8..56f3bab 100644
--- a/sysdeps/m68k/m680x0/fpu/s_csinh.c
+++ b/sysdeps/m68k/m680x0/fpu/s_csinh_template.c
@@ -21,21 +21,14 @@
 #include <math.h>
 #include "mathimpl.h"
 
-#ifndef SUFF
-#define SUFF
-#endif
-#ifndef float_type
-#define float_type double
-#endif
-
 #define CONCATX(a,b) __CONCAT(a,b)
-#define s(name) CONCATX(name,SUFF)
+#define s(name) M_SUF (name)
 #define m81(func) __m81_u(s(func))
 
-__complex__ float_type
-s(__csinh) (__complex__ float_type x)
+CFLOAT
+s(__csinh) (CFLOAT x)
 {
-  __complex__ float_type retval;
+  CFLOAT retval;
   unsigned long ix_cond;
 
   ix_cond = __m81_test (__imag__ x);
@@ -43,7 +36,7 @@ s(__csinh) (__complex__ float_type x)
   if ((ix_cond & (__M81_COND_INF|__M81_COND_NAN)) == 0)
     {
       /* Imaginary part is finite.  */
-      float_type sin_ix, cos_ix;
+      FLOAT sin_ix, cos_ix;
 
       __asm ("fsincos%.x %2,%1:%0" : "=f" (sin_ix), "=f" (cos_ix)
 	     : "f" (__imag__ x));
diff --git a/sysdeps/m68k/m680x0/fpu/s_csinhf.c b/sysdeps/m68k/m680x0/fpu/s_csinhf.c
deleted file mode 100644
index 2f7a43e..0000000
--- a/sysdeps/m68k/m680x0/fpu/s_csinhf.c
+++ /dev/null
@@ -1,3 +0,0 @@
-#define SUFF f
-#define float_type float
-#include <s_csinh.c>
diff --git a/sysdeps/m68k/m680x0/fpu/s_csinhl.c b/sysdeps/m68k/m680x0/fpu/s_csinhl.c
deleted file mode 100644
index 026a20e..0000000
--- a/sysdeps/m68k/m680x0/fpu/s_csinhl.c
+++ /dev/null
@@ -1,3 +0,0 @@
-#define SUFF l
-#define float_type long double
-#include <s_csinh.c>
diff --git a/sysdeps/m68k/m680x0/fpu/s_csinl.c b/sysdeps/m68k/m680x0/fpu/s_csinl.c
deleted file mode 100644
index ea2dad0..0000000
--- a/sysdeps/m68k/m680x0/fpu/s_csinl.c
+++ /dev/null
@@ -1,3 +0,0 @@
-#define SUFF l
-#define float_type long double
-#include <s_csin.c>

http://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=ffb84f5e197aaa9d46a35df84689c75d689d73cb

commit ffb84f5e197aaa9d46a35df84689c75d689d73cb
Author: Paul E. Murphy <murphyp@linux.vnet.ibm.com>
Date:   Fri Jul 1 10:55:27 2016 -0500

    Prepare to convert _Complex sine functions
    
    This patch has no function changes, except to
    ensure the git history correctly tracks the
    changes to convert the double version of these
    functions into a templated version.

diff --git a/ChangeLog b/ChangeLog
index 64c4701..b097cd4 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2016-08-19  Paul E. Murphy  <murphyp@linux.vnet.ibm.com>
+
+	* s_casin_template.c: Copy of s_casin.c.
+	* s_casinh_template.c: Copy of s_casinh.c.
+	* s_csin_template.c: Copy of s_csin.c.
+	* s_csinh_template.c: Copy of s_csinh.c.
+	* k_casinh_template.c: Copy of k_casinh.c.
+
 2016-08-19  H.J. Lu  <hongjiu.lu@intel.com>
 
 	* sysdeps/x86/cpu-features.h (bit_YMM_state): Set to (1 << 2).
diff --git a/math/k_casinh_template.c b/math/k_casinh_template.c
new file mode 100644
index 0000000..354dde1
--- /dev/null
+++ b/math/k_casinh_template.c
@@ -0,0 +1,210 @@
+/* Return arc hyperbole sine for double value, with the imaginary part
+   of the result possibly adjusted for use in computing other
+   functions.
+   Copyright (C) 1997-2016 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <http://www.gnu.org/licenses/>.  */
+
+#include <complex.h>
+#include <math.h>
+#include <math_private.h>
+#include <float.h>
+
+/* Return the complex inverse hyperbolic sine of finite nonzero Z,
+   with the imaginary part of the result subtracted from pi/2 if ADJ
+   is nonzero.  */
+
+__complex__ double
+__kernel_casinh (__complex__ double x, int adj)
+{
+  __complex__ double res;
+  double rx, ix;
+  __complex__ double y;
+
+  /* Avoid cancellation by reducing to the first quadrant.  */
+  rx = fabs (__real__ x);
+  ix = fabs (__imag__ x);
+
+  if (rx >= 1.0 / DBL_EPSILON || ix >= 1.0 / DBL_EPSILON)
+    {
+      /* For large x in the first quadrant, x + csqrt (1 + x * x)
+	 is sufficiently close to 2 * x to make no significant
+	 difference to the result; avoid possible overflow from
+	 the squaring and addition.  */
+      __real__ y = rx;
+      __imag__ y = ix;
+
+      if (adj)
+	{
+	  double t = __real__ y;
+	  __real__ y = __copysign (__imag__ y, __imag__ x);
+	  __imag__ y = t;
+	}
+
+      res = __clog (y);
+      __real__ res += M_LN2;
+    }
+  else if (rx >= 0.5 && ix < DBL_EPSILON / 8.0)
+    {
+      double s = __ieee754_hypot (1.0, rx);
+
+      __real__ res = __ieee754_log (rx + s);
+      if (adj)
+	__imag__ res = __ieee754_atan2 (s, __imag__ x);
+      else
+	__imag__ res = __ieee754_atan2 (ix, s);
+    }
+  else if (rx < DBL_EPSILON / 8.0 && ix >= 1.5)
+    {
+      double s = __ieee754_sqrt ((ix + 1.0) * (ix - 1.0));
+
+      __real__ res = __ieee754_log (ix + s);
+      if (adj)
+	__imag__ res = __ieee754_atan2 (rx, __copysign (s, __imag__ x));
+      else
+	__imag__ res = __ieee754_atan2 (s, rx);
+    }
+  else if (ix > 1.0 && ix < 1.5 && rx < 0.5)
+    {
+      if (rx < DBL_EPSILON * DBL_EPSILON)
+	{
+	  double ix2m1 = (ix + 1.0) * (ix - 1.0);
+	  double s = __ieee754_sqrt (ix2m1);
+
+	  __real__ res = __log1p (2.0 * (ix2m1 + ix * s)) / 2.0;
+	  if (adj)
+	    __imag__ res = __ieee754_atan2 (rx, __copysign (s, __imag__ x));
+	  else
+	    __imag__ res = __ieee754_atan2 (s, rx);
+	}
+      else
+	{
+	  double ix2m1 = (ix + 1.0) * (ix - 1.0);
+	  double rx2 = rx * rx;
+	  double f = rx2 * (2.0 + rx2 + 2.0 * ix * ix);
+	  double d = __ieee754_sqrt (ix2m1 * ix2m1 + f);
+	  double dp = d + ix2m1;
+	  double dm = f / dp;
+	  double r1 = __ieee754_sqrt ((dm + rx2) / 2.0);
+	  double r2 = rx * ix / r1;
+
+	  __real__ res = __log1p (rx2 + dp + 2.0 * (rx * r1 + ix * r2)) / 2.0;
+	  if (adj)
+	    __imag__ res = __ieee754_atan2 (rx + r1, __copysign (ix + r2,
+								 __imag__ x));
+	  else
+	    __imag__ res = __ieee754_atan2 (ix + r2, rx + r1);
+	}
+    }
+  else if (ix == 1.0 && rx < 0.5)
+    {
+      if (rx < DBL_EPSILON / 8.0)
+	{
+	  __real__ res = __log1p (2.0 * (rx + __ieee754_sqrt (rx))) / 2.0;
+	  if (adj)
+	    __imag__ res = __ieee754_atan2 (__ieee754_sqrt (rx),
+					    __copysign (1.0, __imag__ x));
+	  else
+	    __imag__ res = __ieee754_atan2 (1.0, __ieee754_sqrt (rx));
+	}
+      else
+	{
+	  double d = rx * __ieee754_sqrt (4.0 + rx * rx);
+	  double s1 = __ieee754_sqrt ((d + rx * rx) / 2.0);
+	  double s2 = __ieee754_sqrt ((d - rx * rx) / 2.0);
+
+	  __real__ res = __log1p (rx * rx + d + 2.0 * (rx * s1 + s2)) / 2.0;
+	  if (adj)
+	    __imag__ res = __ieee754_atan2 (rx + s1, __copysign (1.0 + s2,
+								 __imag__ x));
+	  else
+	    __imag__ res = __ieee754_atan2 (1.0 + s2, rx + s1);
+	}
+    }
+  else if (ix < 1.0 && rx < 0.5)
+    {
+      if (ix >= DBL_EPSILON)
+	{
+	  if (rx < DBL_EPSILON * DBL_EPSILON)
+	    {
+	      double onemix2 = (1.0 + ix) * (1.0 - ix);
+	      double s = __ieee754_sqrt (onemix2);
+
+	      __real__ res = __log1p (2.0 * rx / s) / 2.0;
+	      if (adj)
+		__imag__ res = __ieee754_atan2 (s, __imag__ x);
+	      else
+		__imag__ res = __ieee754_atan2 (ix, s);
+	    }
+	  else
+	    {
+	      double onemix2 = (1.0 + ix) * (1.0 - ix);
+	      double rx2 = rx * rx;
+	      double f = rx2 * (2.0 + rx2 + 2.0 * ix * ix);
+	      double d = __ieee754_sqrt (onemix2 * onemix2 + f);
+	      double dp = d + onemix2;
+	      double dm = f / dp;
+	      double r1 = __ieee754_sqrt ((dp + rx2) / 2.0);
+	      double r2 = rx * ix / r1;
+
+	      __real__ res
+		= __log1p (rx2 + dm + 2.0 * (rx * r1 + ix * r2)) / 2.0;
+	      if (adj)
+		__imag__ res = __ieee754_atan2 (rx + r1,
+						__copysign (ix + r2,
+							    __imag__ x));
+	      else
+		__imag__ res = __ieee754_atan2 (ix + r2, rx + r1);
+	    }
+	}
+      else
+	{
+	  double s = __ieee754_hypot (1.0, rx);
+
+	  __real__ res = __log1p (2.0 * rx * (rx + s)) / 2.0;
+	  if (adj)
+	    __imag__ res = __ieee754_atan2 (s, __imag__ x);
+	  else
+	    __imag__ res = __ieee754_atan2 (ix, s);
+	}
+      math_check_force_underflow_nonneg (__real__ res);
+    }
+  else
+    {
+      __real__ y = (rx - ix) * (rx + ix) + 1.0;
+      __imag__ y = 2.0 * rx * ix;
+
+      y = __csqrt (y);
+
+      __real__ y += rx;
+      __imag__ y += ix;
+
+      if (adj)
+	{
+	  double t = __real__ y;
+	  __real__ y = __copysign (__imag__ y, __imag__ x);
+	  __imag__ y = t;
+	}
+
+      res = __clog (y);
+    }
+
+  /* Give results the correct sign for the original argument.  */
+  __real__ res = __copysign (__real__ res, __real__ x);
+  __imag__ res = __copysign (__imag__ res, (adj ? 1.0 : __imag__ x));
+
+  return res;
+}
diff --git a/math/s_casin_template.c b/math/s_casin_template.c
new file mode 100644
index 0000000..a37933b
--- /dev/null
+++ b/math/s_casin_template.c
@@ -0,0 +1,66 @@
+/* Return arc sine of complex double value.
+   Copyright (C) 1997-2016 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, see
+   <http://www.gnu.org/licenses/>.  */
+
+#include <complex.h>
+#include <math.h>
+#include <math_private.h>
+
+
+__complex__ double
+__casin (__complex__ double x)
+{
+  __complex__ double res;
+
+  if (isnan (__real__ x) || isnan (__imag__ x))
+    {
+      if (__real__ x == 0.0)
+	{
+	  res = x;
+	}
+      else if (isinf (__real__ x) || isinf (__imag__ x))
+	{
+	  __real__ res = __nan ("");
+	  __imag__ res = __copysign (HUGE_VAL, __imag__ x);
+	}
+      else
+	{
+	  __real__ res = __nan ("");
+	  __imag__ res = __nan ("");
+	}
+    }
+  else
+    {
+      __complex__ double y;
+
+      __real__ y = -__imag__ x;
+      __imag__ y = __real__ x;
+
+      y = __casinh (y);
+
+      __real__ res = __imag__ y;
+      __imag__ res = -__real__ y;
+    }
+
+  return res;
+}
+weak_alias (__casin, casin)
+#ifdef NO_LONG_DOUBLE
+strong_alias (__casin, __casinl)
+weak_alias (__casin, casinl)
+#endif
diff --git a/math/s_casinh_template.c b/math/s_casinh_template.c
new file mode 100644
index 0000000..32cbc13
--- /dev/null
+++ b/math/s_casinh_template.c
@@ -0,0 +1,73 @@
+/* Return arc hyperbole sine for double value.
+   Copyright (C) 1997-2016 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, see
+   <http://www.gnu.org/licenses/>.  */
+
+#include <complex.h>
+#include <math.h>
+#include <math_private.h>
+
+__complex__ double
+__casinh (__complex__ double x)
+{
+  __complex__ double res;
+  int rcls = fpclassify (__real__ x);
+  int icls = fpclassify (__imag__ x);
+
+  if (rcls <= FP_INFINITE || icls <= FP_INFINITE)
+    {
+      if (icls == FP_INFINITE)
+	{
+	  __real__ res = __copysign (HUGE_VAL, __real__ x);
+
+	  if (rcls == FP_NAN)
+	    __imag__ res = __nan ("");
+	  else
+	    __imag__ res = __copysign (rcls >= FP_ZERO ? M_PI_2 : M_PI_4,
+				       __imag__ x);
+	}
+      else if (rcls <= FP_INFINITE)
+	{
+	  __real__ res = __real__ x;
+	  if ((rcls == FP_INFINITE && icls >= FP_ZERO)
+	      || (rcls == FP_NAN && icls == FP_ZERO))
+	    __imag__ res = __copysign (0.0, __imag__ x);
+	  else
+	    __imag__ res = __nan ("");
+	}
+      else
+	{
+	  __real__ res = __nan ("");
+	  __imag__ res = __nan ("");
+	}
+    }
+  else if (rcls == FP_ZERO && icls == FP_ZERO)
+    {
+      res = x;
+    }
+  else
+    {
+      res = __kernel_casinh (x, 0);
+    }
+
+  return res;
+}
+weak_alias (__casinh, casinh)
+#ifdef NO_LONG_DOUBLE
+strong_alias (__casinh, __casinhl)
+weak_alias (__casinh, casinhl)
+#endif
diff --git a/math/s_csin_template.c b/math/s_csin_template.c
new file mode 100644
index 0000000..e071aa6
--- /dev/null
+++ b/math/s_csin_template.c
@@ -0,0 +1,171 @@
+/* Complex sine function for double.
+   Copyright (C) 1997-2016 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, see
+   <http://www.gnu.org/licenses/>.  */
+
+#include <complex.h>
+#include <fenv.h>
+#include <math.h>
+#include <math_private.h>
+#include <float.h>
+
+__complex__ double
+__csin (__complex__ double x)
+{
+  __complex__ double retval;
+  int negate = signbit (__real__ x);
+  int rcls = fpclassify (__real__ x);
+  int icls = fpclassify (__imag__ x);
+
+  __real__ x = fabs (__real__ x);
+
+  if (__glibc_likely (icls >= FP_ZERO))
+    {
+      /* Imaginary part is finite.  */
+      if (__glibc_likely (rcls >= FP_ZERO))
+	{
+	  /* Real part is finite.  */
+	  const int t = (int) ((DBL_MAX_EXP - 1) * M_LN2);
+	  double sinix, cosix;
+
+	  if (__glibc_likely (__real__ x > DBL_MIN))
+	    {
+	      __sincos (__real__ x, &sinix, &cosix);
+	    }
+	  else
+	    {
+	      sinix = __real__ x;
+	      cosix = 1.0;
+	    }
+
+	  if (negate)
+	    sinix = -sinix;
+
+	  if (fabs (__imag__ x) > t)
+	    {
+	      double exp_t = __ieee754_exp (t);
+	      double ix = fabs (__imag__ x);
+	      if (signbit (__imag__ x))
+		cosix = -cosix;
+	      ix -= t;
+	      sinix *= exp_t / 2.0;
+	      cosix *= exp_t / 2.0;
+	      if (ix > t)
+		{
+		  ix -= t;
+		  sinix *= exp_t;
+		  cosix *= exp_t;
+		}
+	      if (ix > t)
+		{
+		  /* Overflow (original imaginary part of x > 3t).  */
+		  __real__ retval = DBL_MAX * sinix;
+		  __imag__ retval = DBL_MAX * cosix;
+		}
+	      else
+		{
+		  double exp_val = __ieee754_exp (ix);
+		  __real__ retval = exp_val * sinix;
+		  __imag__ retval = exp_val * cosix;
+		}
+	    }
+	  else
+	    {
+	      __real__ retval = __ieee754_cosh (__imag__ x) * sinix;
+	      __imag__ retval = __ieee754_sinh (__imag__ x) * cosix;
+	    }
+
+	  math_check_force_underflow_complex (retval);
+	}
+      else
+	{
+	  if (icls == FP_ZERO)
+	    {
+	      /* Imaginary part is 0.0.  */
+	      __real__ retval = __nan ("");
+	      __imag__ retval = __imag__ x;
+
+	      if (rcls == FP_INFINITE)
+		feraiseexcept (FE_INVALID);
+	    }
+	  else
+	    {
+	      __real__ retval = __nan ("");
+	      __imag__ retval = __nan ("");
+
+	      feraiseexcept (FE_INVALID);
+	    }
+	}
+    }
+  else if (icls == FP_INFINITE)
+    {
+      /* Imaginary part is infinite.  */
+      if (rcls == FP_ZERO)
+	{
+	  /* Real part is 0.0.  */
+	  __real__ retval = __copysign (0.0, negate ? -1.0 : 1.0);
+	  __imag__ retval = __imag__ x;
+	}
+      else if (rcls > FP_ZERO)
+	{
+	  /* Real part is finite.  */
+	  double sinix, cosix;
+
+	  if (__glibc_likely (__real__ x > DBL_MIN))
+	    {
+	      __sincos (__real__ x, &sinix, &cosix);
+	    }
+	  else
+	    {
+	      sinix = __real__ x;
+	      cosix = 1.0;
+	    }
+
+	  __real__ retval = __copysign (HUGE_VAL, sinix);
+	  __imag__ retval = __copysign (HUGE_VAL, cosix);
+
+	  if (negate)
+	    __real__ retval = -__real__ retval;
+	  if (signbit (__imag__ x))
+	    __imag__ retval = -__imag__ retval;
+	}
+      else
+	{
+	  /* The addition raises the invalid exception.  */
+	  __real__ retval = __nan ("");
+	  __imag__ retval = HUGE_VAL;
+
+	  if (rcls == FP_INFINITE)
+	    feraiseexcept (FE_INVALID);
+	}
+    }
+  else
+    {
+      if (rcls == FP_ZERO)
+	__real__ retval = __copysign (0.0, negate ? -1.0 : 1.0);
+      else
+	__real__ retval = __nan ("");
+      __imag__ retval = __nan ("");
+    }
+
+  return retval;
+}
+weak_alias (__csin, csin)
+#ifdef NO_LONG_DOUBLE
+strong_alias (__csin, __csinl)
+weak_alias (__csin, csinl)
+#endif
diff --git a/math/s_csinh_template.c b/math/s_csinh_template.c
new file mode 100644
index 0000000..5fb60ed
--- /dev/null
+++ b/math/s_csinh_template.c
@@ -0,0 +1,166 @@
+/* Complex sine hyperbole function for double.
+   Copyright (C) 1997-2016 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, see
+   <http://www.gnu.org/licenses/>.  */
+
+#include <complex.h>
+#include <fenv.h>
+#include <math.h>
+#include <math_private.h>
+#include <float.h>
+
+__complex__ double
+__csinh (__complex__ double x)
+{
+  __complex__ double retval;
+  int negate = signbit (__real__ x);
+  int rcls = fpclassify (__real__ x);
+  int icls = fpclassify (__imag__ x);
+
+  __real__ x = fabs (__real__ x);
+
+  if (__glibc_likely (rcls >= FP_ZERO))
+    {
+      /* Real part is finite.  */
+      if (__glibc_likely (icls >= FP_ZERO))
+	{
+	  /* Imaginary part is finite.  */
+	  const int t = (int) ((DBL_MAX_EXP - 1) * M_LN2);
+	  double sinix, cosix;
+
+	  if (__glibc_likely (fabs (__imag__ x) > DBL_MIN))
+	    {
+	      __sincos (__imag__ x, &sinix, &cosix);
+	    }
+	  else
+	    {
+	      sinix = __imag__ x;
+	      cosix = 1.0;
+	    }
+
+	  if (negate)
+	    cosix = -cosix;
+
+	  if (fabs (__real__ x) > t)
+	    {
+	      double exp_t = __ieee754_exp (t);
+	      double rx = fabs (__real__ x);
+	      if (signbit (__real__ x))
+		cosix = -cosix;
+	      rx -= t;
+	      sinix *= exp_t / 2.0;
+	      cosix *= exp_t / 2.0;
+	      if (rx > t)
+		{
+		  rx -= t;
+		  sinix *= exp_t;
+		  cosix *= exp_t;
+		}
+	      if (rx > t)
+		{
+		  /* Overflow (original real part of x > 3t).  */
+		  __real__ retval = DBL_MAX * cosix;
+		  __imag__ retval = DBL_MAX * sinix;
+		}
+	      else
+		{
+		  double exp_val = __ieee754_exp (rx);
+		  __real__ retval = exp_val * cosix;
+		  __imag__ retval = exp_val * sinix;
+		}
+	    }
+	  else
+	    {
+	      __real__ retval = __ieee754_sinh (__real__ x) * cosix;
+	      __imag__ retval = __ieee754_cosh (__real__ x) * sinix;
+	    }
+
+	  math_check_force_underflow_complex (retval);
+	}
+      else
+	{
+	  if (rcls == FP_ZERO)
+	    {
+	      /* Real part is 0.0.  */
+	      __real__ retval = __copysign (0.0, negate ? -1.0 : 1.0);
+	      __imag__ retval = __nan ("") + __nan ("");
+
+	      if (icls == FP_INFINITE)
+		feraiseexcept (FE_INVALID);
+	    }
+	  else
+	    {
+	      __real__ retval = __nan ("");
+	      __imag__ retval = __nan ("");
+
+	      feraiseexcept (FE_INVALID);
+	    }
+	}
+    }
+  else if (rcls == FP_INFINITE)
+    {
+      /* Real part is infinite.  */
+      if (__glibc_likely (icls > FP_ZERO))
+	{
+	  /* Imaginary part is finite.  */
+	  double sinix, cosix;
+
+	  if (__glibc_likely (fabs (__imag__ x) > DBL_MIN))
+	    {
+	      __sincos (__imag__ x, &sinix, &cosix);
+	    }
+	  else
+	    {
+	      sinix = __imag__ x;
+	      cosix = 1.0;
+	    }
+
+	  __real__ retval = __copysign (HUGE_VAL, cosix);
+	  __imag__ retval = __copysign (HUGE_VAL, sinix);
+
+	  if (negate)
+	    __real__ retval = -__real__ retval;
+	}
+      else if (icls == FP_ZERO)
+	{
+	  /* Imaginary part is 0.0.  */
+	  __real__ retval = negate ? -HUGE_VAL : HUGE_VAL;
+	  __imag__ retval = __imag__ x;
+	}
+      else
+	{
+	  /* The addition raises the invalid exception.  */
+	  __real__ retval = HUGE_VAL;
+	  __imag__ retval = __nan ("") + __nan ("");
+
+	  if (icls == FP_INFINITE)
+	    feraiseexcept (FE_INVALID);
+	}
+    }
+  else
+    {
+      __real__ retval = __nan ("");
+      __imag__ retval = __imag__ x == 0.0 ? __imag__ x : __nan ("");
+    }
+
+  return retval;
+}
+weak_alias (__csinh, csinh)
+#ifdef NO_LONG_DOUBLE
+strong_alias (__csinh, __csinhl)
+weak_alias (__csinh, csinhl)
+#endif

-----------------------------------------------------------------------

Summary of changes:
 ChangeLog                                  |  103 +++++++++++++
 math/Makefile                              |   13 +-
 math/k_casinh.c                            |  210 --------------------------
 math/k_casinh_template.c                   |  205 ++++++++++++++++++++++++++
 math/k_casinhf.c                           |  212 ---------------------------
 math/k_casinhl.c                           |  219 ----------------------------
 math/s_casin.c                             |   66 ---------
 math/s_casin_template.c                    |   67 +++++++++
 math/s_casinf.c                            |   64 --------
 math/s_casinh.c                            |   73 ---------
 math/s_casinh_template.c                   |   75 ++++++++++
 math/s_casinhf.c                           |   71 ---------
 math/s_casinhl.c                           |   69 ---------
 math/s_casinl.c                            |   62 --------
 math/s_catan.c                             |  143 ------------------
 math/s_catan_template.c                    |  145 ++++++++++++++++++
 math/s_catanf.c                            |  143 ------------------
 math/s_catanh.c                            |  137 -----------------
 math/s_catanh_template.c                   |  139 ++++++++++++++++++
 math/s_catanhf.c                           |  137 -----------------
 math/s_catanhl.c                           |  141 ------------------
 math/s_catanl.c                            |  147 -------------------
 math/s_csin.c                              |  171 ----------------------
 math/s_csin_template.c                     |  172 ++++++++++++++++++++++
 math/s_csinf.c                             |  169 ---------------------
 math/s_csinh.c                             |  166 ---------------------
 math/s_csinh_template.c                    |  167 +++++++++++++++++++++
 math/s_csinhf.c                            |  164 ---------------------
 math/s_csinhl.c                            |  162 --------------------
 math/s_csinl.c                             |  167 ---------------------
 math/s_ctan.c                              |  129 ----------------
 math/s_ctan_template.c                     |  130 ++++++++++++++++
 math/s_ctanf.c                             |  127 ----------------
 math/s_ctanh.c                             |  129 ----------------
 math/s_ctanh_template.c                    |  130 ++++++++++++++++
 math/s_ctanhf.c                            |  127 ----------------
 math/s_ctanhl.c                            |  132 -----------------
 math/s_ctanl.c                             |  132 -----------------
 sysdeps/alpha/fpu/s_casinf.c               |   12 +-
 sysdeps/alpha/fpu/s_casinhf.c              |   12 +-
 sysdeps/alpha/fpu/s_catanf.c               |   12 +-
 sysdeps/alpha/fpu/s_catanhf.c              |   12 +-
 sysdeps/alpha/fpu/s_csinf.c                |   12 +-
 sysdeps/alpha/fpu/s_csinhf.c               |   12 +-
 sysdeps/alpha/fpu/s_ctanf.c                |   12 +-
 sysdeps/alpha/fpu/s_ctanhf.c               |   12 +-
 sysdeps/ieee754/ldbl-opt/s_casin.c         |    6 -
 sysdeps/ieee754/ldbl-opt/s_casinh.c        |    6 -
 sysdeps/ieee754/ldbl-opt/s_casinhl.c       |    6 -
 sysdeps/ieee754/ldbl-opt/s_casinl.c        |    6 -
 sysdeps/ieee754/ldbl-opt/s_catan.c         |    6 -
 sysdeps/ieee754/ldbl-opt/s_catanh.c        |    6 -
 sysdeps/ieee754/ldbl-opt/s_catanhl.c       |    6 -
 sysdeps/ieee754/ldbl-opt/s_catanl.c        |    6 -
 sysdeps/ieee754/ldbl-opt/s_csin.c          |    6 -
 sysdeps/ieee754/ldbl-opt/s_csinh.c         |    6 -
 sysdeps/ieee754/ldbl-opt/s_csinhl.c        |    6 -
 sysdeps/ieee754/ldbl-opt/s_csinl.c         |    6 -
 sysdeps/ieee754/ldbl-opt/s_ctan.c          |    6 -
 sysdeps/ieee754/ldbl-opt/s_ctanh.c         |    6 -
 sysdeps/ieee754/ldbl-opt/s_ctanhl.c        |    6 -
 sysdeps/ieee754/ldbl-opt/s_ctanl.c         |    6 -
 sysdeps/m68k/m680x0/fpu/s_csin.c           |   67 ---------
 sysdeps/m68k/m680x0/fpu/s_csin_template.c  |   59 ++++++++
 sysdeps/m68k/m680x0/fpu/s_csinf.c          |    3 -
 sysdeps/m68k/m680x0/fpu/s_csinh.c          |   69 ---------
 sysdeps/m68k/m680x0/fpu/s_csinh_template.c |   62 ++++++++
 sysdeps/m68k/m680x0/fpu/s_csinhf.c         |    3 -
 sysdeps/m68k/m680x0/fpu/s_csinhl.c         |    3 -
 sysdeps/m68k/m680x0/fpu/s_csinl.c          |    3 -
 70 files changed, 1525 insertions(+), 3951 deletions(-)
 delete mode 100644 math/k_casinh.c
 create mode 100644 math/k_casinh_template.c
 delete mode 100644 math/k_casinhf.c
 delete mode 100644 math/k_casinhl.c
 delete mode 100644 math/s_casin.c
 create mode 100644 math/s_casin_template.c
 delete mode 100644 math/s_casinf.c
 delete mode 100644 math/s_casinh.c
 create mode 100644 math/s_casinh_template.c
 delete mode 100644 math/s_casinhf.c
 delete mode 100644 math/s_casinhl.c
 delete mode 100644 math/s_casinl.c
 delete mode 100644 math/s_catan.c
 create mode 100644 math/s_catan_template.c
 delete mode 100644 math/s_catanf.c
 delete mode 100644 math/s_catanh.c
 create mode 100644 math/s_catanh_template.c
 delete mode 100644 math/s_catanhf.c
 delete mode 100644 math/s_catanhl.c
 delete mode 100644 math/s_catanl.c
 delete mode 100644 math/s_csin.c
 create mode 100644 math/s_csin_template.c
 delete mode 100644 math/s_csinf.c
 delete mode 100644 math/s_csinh.c
 create mode 100644 math/s_csinh_template.c
 delete mode 100644 math/s_csinhf.c
 delete mode 100644 math/s_csinhl.c
 delete mode 100644 math/s_csinl.c
 delete mode 100644 math/s_ctan.c
 create mode 100644 math/s_ctan_template.c
 delete mode 100644 math/s_ctanf.c
 delete mode 100644 math/s_ctanh.c
 create mode 100644 math/s_ctanh_template.c
 delete mode 100644 math/s_ctanhf.c
 delete mode 100644 math/s_ctanhl.c
 delete mode 100644 math/s_ctanl.c
 delete mode 100644 sysdeps/ieee754/ldbl-opt/s_casin.c
 delete mode 100644 sysdeps/ieee754/ldbl-opt/s_casinh.c
 delete mode 100644 sysdeps/ieee754/ldbl-opt/s_casinhl.c
 delete mode 100644 sysdeps/ieee754/ldbl-opt/s_casinl.c
 delete mode 100644 sysdeps/ieee754/ldbl-opt/s_catan.c
 delete mode 100644 sysdeps/ieee754/ldbl-opt/s_catanh.c
 delete mode 100644 sysdeps/ieee754/ldbl-opt/s_catanhl.c
 delete mode 100644 sysdeps/ieee754/ldbl-opt/s_catanl.c
 delete mode 100644 sysdeps/ieee754/ldbl-opt/s_csin.c
 delete mode 100644 sysdeps/ieee754/ldbl-opt/s_csinh.c
 delete mode 100644 sysdeps/ieee754/ldbl-opt/s_csinhl.c
 delete mode 100644 sysdeps/ieee754/ldbl-opt/s_csinl.c
 delete mode 100644 sysdeps/ieee754/ldbl-opt/s_ctan.c
 delete mode 100644 sysdeps/ieee754/ldbl-opt/s_ctanh.c
 delete mode 100644 sysdeps/ieee754/ldbl-opt/s_ctanhl.c
 delete mode 100644 sysdeps/ieee754/ldbl-opt/s_ctanl.c
 delete mode 100644 sysdeps/m68k/m680x0/fpu/s_csin.c
 create mode 100644 sysdeps/m68k/m680x0/fpu/s_csin_template.c
 delete mode 100644 sysdeps/m68k/m680x0/fpu/s_csinf.c
 delete mode 100644 sysdeps/m68k/m680x0/fpu/s_csinh.c
 create mode 100644 sysdeps/m68k/m680x0/fpu/s_csinh_template.c
 delete mode 100644 sysdeps/m68k/m680x0/fpu/s_csinhf.c
 delete mode 100644 sysdeps/m68k/m680x0/fpu/s_csinhl.c
 delete mode 100644 sysdeps/m68k/m680x0/fpu/s_csinl.c


hooks/post-receive
-- 
GNU C Library master sources


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