diff options
| author | Paul E. Murphy <murphyp@linux.vnet.ibm.com> | 2016-06-27 17:11:46 -0500 |
|---|---|---|
| committer | Paul E. Murphy <murphyp@linux.vnet.ibm.com> | 2016-08-19 11:28:55 -0500 |
| commit | 01ee387015a2075c45a4e1ad45d39e50b5a6d40b (patch) | |
| tree | c8d2a88b0900c294d5e82fe869908d46b3ca838f /math | |
| parent | 281f5073e5a6d2cd3733acd9c773c8c6340468c4 (diff) | |
| download | glibc-01ee387015a2075c45a4e1ad45d39e50b5a6d40b.tar.xz glibc-01ee387015a2075c45a4e1ad45d39e50b5a6d40b.zip | |
Convert _Complex cosine functions to generated code
This is fairly straight fowards. m68k overrides are
updated to use the framework, and thus are simplified
a bit.
Diffstat (limited to 'math')
| -rw-r--r-- | math/Makefile | 9 | ||||
| -rw-r--r-- | math/s_cacos.c | 58 | ||||
| -rw-r--r-- | math/s_cacos_template.c | 29 | ||||
| -rw-r--r-- | math/s_cacosf.c | 56 | ||||
| -rw-r--r-- | math/s_cacosh.c | 94 | ||||
| -rw-r--r-- | math/s_cacosh_template.c | 50 | ||||
| -rw-r--r-- | math/s_cacoshf.c | 92 | ||||
| -rw-r--r-- | math/s_cacoshl.c | 90 | ||||
| -rw-r--r-- | math/s_cacosl.c | 54 | ||||
| -rw-r--r-- | math/s_ccos.c | 40 | ||||
| -rw-r--r-- | math/s_ccos_template.c | 20 | ||||
| -rw-r--r-- | math/s_ccosf.c | 38 | ||||
| -rw-r--r-- | math/s_ccosh.c | 147 | ||||
| -rw-r--r-- | math/s_ccosh_template.c | 77 | ||||
| -rw-r--r-- | math/s_ccoshf.c | 145 | ||||
| -rw-r--r-- | math/s_ccoshl.c | 143 | ||||
| -rw-r--r-- | math/s_ccosl.c | 36 |
17 files changed, 95 insertions, 1083 deletions
diff --git a/math/Makefile b/math/Makefile index 2ff1405110..e02b430e04 100644 --- a/math/Makefile +++ b/math/Makefile @@ -45,7 +45,8 @@ 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 +gen-libm-calls = cargF conjF cimagF crealF cabsF s_cacosF \ + s_cacoshF s_ccosF s_ccoshF libm-calls = \ e_acosF e_acoshF e_asinF e_atan2F e_atanhF e_coshF e_expF e_fmodF \ @@ -63,9 +64,9 @@ 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_ccoshF s_clogF \ - s_catanF s_casinF s_ccosF s_csinF s_ctanF s_ctanhF s_cacosF \ - s_casinhF s_cacoshF s_catanhF s_csqrtF s_cpowF s_cprojF s_clog10F \ + 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_fmaF s_lrintF s_llrintF s_lroundF s_llroundF e_exp10F w_log2F \ s_issignalingF $(calls:s_%=m_%) x2y2m1F k_casinhF \ gamma_productF lgamma_negF lgamma_productF \ diff --git a/math/s_cacos.c b/math/s_cacos.c deleted file mode 100644 index 234b12271b..0000000000 --- a/math/s_cacos.c +++ /dev/null @@ -1,58 +0,0 @@ -/* Return cosine 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> - -__complex__ double -__cacos (__complex__ double x) -{ - __complex__ double y; - __complex__ double res; - int rcls = fpclassify (__real__ x); - int icls = fpclassify (__imag__ x); - - if (rcls <= FP_INFINITE || icls <= FP_INFINITE - || (rcls == FP_ZERO && icls == FP_ZERO)) - { - y = __casin (x); - - __real__ res = (double) M_PI_2 - __real__ y; - if (__real__ res == 0.0) - __real__ res = 0.0; - __imag__ res = -__imag__ y; - } - else - { - __real__ y = -__imag__ x; - __imag__ y = __real__ x; - - y = __kernel_casinh (y, 1); - - __real__ res = __imag__ y; - __imag__ res = __real__ y; - } - - return res; -} -weak_alias (__cacos, cacos) -#ifdef NO_LONG_DOUBLE -strong_alias (__cacos, __cacosl) -weak_alias (__cacos, cacosl) -#endif diff --git a/math/s_cacos_template.c b/math/s_cacos_template.c index 234b12271b..6494a1f2f6 100644 --- a/math/s_cacos_template.c +++ b/math/s_cacos_template.c @@ -1,4 +1,4 @@ -/* Return cosine of complex double value. +/* Return cosine of a complex 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. @@ -20,22 +20,22 @@ #include <complex.h> #include <math.h> -__complex__ double -__cacos (__complex__ double x) +CFLOAT +M_DECL_FUNC (__cacos) (CFLOAT x) { - __complex__ double y; - __complex__ double res; + CFLOAT y; + CFLOAT res; int rcls = fpclassify (__real__ x); int icls = fpclassify (__imag__ x); if (rcls <= FP_INFINITE || icls <= FP_INFINITE || (rcls == FP_ZERO && icls == FP_ZERO)) { - y = __casin (x); + y = M_SUF (__casin) (x); - __real__ res = (double) M_PI_2 - __real__ y; - if (__real__ res == 0.0) - __real__ res = 0.0; + __real__ res = (FLOAT) M_MLIT (M_PI_2) - __real__ y; + if (__real__ res == 0) + __real__ res = 0; __imag__ res = -__imag__ y; } else @@ -43,7 +43,7 @@ __cacos (__complex__ double x) __real__ y = -__imag__ x; __imag__ y = __real__ x; - y = __kernel_casinh (y, 1); + y = M_SUF (__kernel_casinh) (y, 1); __real__ res = __imag__ y; __imag__ res = __real__ y; @@ -51,8 +51,9 @@ __cacos (__complex__ double x) return res; } -weak_alias (__cacos, cacos) -#ifdef NO_LONG_DOUBLE -strong_alias (__cacos, __cacosl) -weak_alias (__cacos, cacosl) + +declare_mgen_alias (__cacos, cacos); + +#if M_LIBM_NEED_COMPAT (carg) +declare_mgen_libm_compat (__cacos, cacos) #endif diff --git a/math/s_cacosf.c b/math/s_cacosf.c deleted file mode 100644 index ab5239281d..0000000000 --- a/math/s_cacosf.c +++ /dev/null @@ -1,56 +0,0 @@ -/* Return cosine 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> - -__complex__ float -__cacosf (__complex__ float x) -{ - __complex__ float y; - __complex__ float res; - int rcls = fpclassify (__real__ x); - int icls = fpclassify (__imag__ x); - - if (rcls <= FP_INFINITE || icls <= FP_INFINITE - || (rcls == FP_ZERO && icls == FP_ZERO)) - { - y = __casinf (x); - - __real__ res = (float) M_PI_2 - __real__ y; - if (__real__ res == 0.0f) - __real__ res = 0.0f; - __imag__ res = -__imag__ y; - } - else - { - __real__ y = -__imag__ x; - __imag__ y = __real__ x; - - y = __kernel_casinhf (y, 1); - - __real__ res = __imag__ y; - __imag__ res = __real__ y; - } - - return res; -} -#ifndef __cacosf -weak_alias (__cacosf, cacosf) -#endif diff --git a/math/s_cacosh.c b/math/s_cacosh.c deleted file mode 100644 index 20bf2158b8..0000000000 --- a/math/s_cacosh.c +++ /dev/null @@ -1,94 +0,0 @@ -/* Return arc hyperbole cosine 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 -__cacosh (__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 = HUGE_VAL; - - if (rcls == FP_NAN) - __imag__ res = __nan (""); - else - __imag__ res = __copysign ((rcls == FP_INFINITE - ? (__real__ x < 0.0 - ? M_PI - M_PI_4 : M_PI_4) - : M_PI_2), __imag__ x); - } - else if (rcls == FP_INFINITE) - { - __real__ res = HUGE_VAL; - - if (icls >= FP_ZERO) - __imag__ res = __copysign (signbit (__real__ x) ? M_PI : 0.0, - __imag__ x); - else - __imag__ res = __nan (""); - } - else - { - __real__ res = __nan (""); - __imag__ res = __nan (""); - } - } - else if (rcls == FP_ZERO && icls == FP_ZERO) - { - __real__ res = 0.0; - __imag__ res = __copysign (M_PI_2, __imag__ x); - } - else - { - __complex__ double y; - - __real__ y = -__imag__ x; - __imag__ y = __real__ x; - - y = __kernel_casinh (y, 1); - - if (signbit (__imag__ x)) - { - __real__ res = __real__ y; - __imag__ res = -__imag__ y; - } - else - { - __real__ res = -__real__ y; - __imag__ res = __imag__ y; - } - } - - return res; -} -weak_alias (__cacosh, cacosh) -#ifdef NO_LONG_DOUBLE -strong_alias (__cacosh, __cacoshl) -weak_alias (__cacosh, cacoshl) -#endif diff --git a/math/s_cacosh_template.c b/math/s_cacosh_template.c index 20bf2158b8..e44da39a10 100644 --- a/math/s_cacosh_template.c +++ b/math/s_cacosh_template.c @@ -1,4 +1,4 @@ -/* Return arc hyperbole cosine for double value. +/* Return arc hyperbolic cosine for a complex 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> -__complex__ double -__cacosh (__complex__ double x) +CFLOAT +M_DECL_FUNC (__cacosh) (CFLOAT x) { - __complex__ double res; + CFLOAT res; int rcls = fpclassify (__real__ x); int icls = fpclassify (__imag__ x); @@ -33,45 +33,46 @@ __cacosh (__complex__ double x) { if (icls == FP_INFINITE) { - __real__ res = HUGE_VAL; + __real__ res = M_HUGE_VAL; if (rcls == FP_NAN) - __imag__ res = __nan (""); + __imag__ res = M_NAN; else - __imag__ res = __copysign ((rcls == FP_INFINITE - ? (__real__ x < 0.0 - ? M_PI - M_PI_4 : M_PI_4) - : M_PI_2), __imag__ x); + __imag__ res = M_COPYSIGN ((rcls == FP_INFINITE + ? (__real__ x < 0 + ? M_MLIT (M_PI) - M_MLIT (M_PI_4) + : M_MLIT (M_PI_4)) + : M_MLIT (M_PI_2)), __imag__ x); } else if (rcls == FP_INFINITE) { - __real__ res = HUGE_VAL; + __real__ res = M_HUGE_VAL; if (icls >= FP_ZERO) - __imag__ res = __copysign (signbit (__real__ x) ? M_PI : 0.0, - __imag__ x); + __imag__ res = M_COPYSIGN (signbit (__real__ x) + ? M_MLIT (M_PI) : 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) { - __real__ res = 0.0; - __imag__ res = __copysign (M_PI_2, __imag__ x); + __real__ res = 0; + __imag__ res = M_COPYSIGN (M_MLIT (M_PI_2), __imag__ x); } else { - __complex__ double y; + CFLOAT y; __real__ y = -__imag__ x; __imag__ y = __real__ x; - y = __kernel_casinh (y, 1); + y = M_SUF (__kernel_casinh) (y, 1); if (signbit (__imag__ x)) { @@ -87,8 +88,9 @@ __cacosh (__complex__ double x) return res; } -weak_alias (__cacosh, cacosh) -#ifdef NO_LONG_DOUBLE -strong_alias (__cacosh, __cacoshl) -weak_alias (__cacosh, cacoshl) + +declare_mgen_alias (__cacosh, cacosh) + +#if M_LIBM_NEED_COMPAT (cacosh) +declare_mgen_libm_compat (__cacosh, cacosh) #endif diff --git a/math/s_cacoshf.c b/math/s_cacoshf.c deleted file mode 100644 index f1a1369705..0000000000 --- a/math/s_cacoshf.c +++ /dev/null @@ -1,92 +0,0 @@ -/* Return arc hyperbole cosine 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 -__cacoshf (__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 = HUGE_VALF; - - if (rcls == FP_NAN) - __imag__ res = __nanf (""); - else - __imag__ res = __copysignf ((rcls == FP_INFINITE - ? (__real__ x < 0.0 - ? M_PI - M_PI_4 : M_PI_4) - : M_PI_2), __imag__ x); - } - else if (rcls == FP_INFINITE) - { - __real__ res = HUGE_VALF; - - if (icls >= FP_ZERO) - __imag__ res = __copysignf (signbit (__real__ x) ? M_PI : 0.0, - __imag__ x); - else - __imag__ res = __nanf (""); - } - else - { - __real__ res = __nanf (""); - __imag__ res = __nanf (""); - } - } - else if (rcls == FP_ZERO && icls == FP_ZERO) - { - __real__ res = 0.0; - __imag__ res = __copysignf (M_PI_2, __imag__ x); - } - else - { - __complex__ float y; - - __real__ y = -__imag__ x; - __imag__ y = __real__ x; - - y = __kernel_casinhf (y, 1); - - if (signbit (__imag__ x)) - { - __real__ res = __real__ y; - __imag__ res = -__imag__ y; - } - else - { - __real__ res = -__real__ y; - __imag__ res = __imag__ y; - } - } - - return res; -} -#ifndef __cacoshf -weak_alias (__cacoshf, cacoshf) -#endif diff --git a/math/s_cacoshl.c b/math/s_cacoshl.c deleted file mode 100644 index c512c2ad71..0000000000 --- a/math/s_cacoshl.c +++ /dev/null @@ -1,90 +0,0 @@ -/* Return arc hyperbole cosine 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 -__cacoshl (__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 = HUGE_VALL; - - if (rcls == FP_NAN) - __imag__ res = __nanl (""); - else - __imag__ res = __copysignl ((rcls == FP_INFINITE - ? (__real__ x < 0.0 - ? M_PIl - M_PI_4l : M_PI_4l) - : M_PI_2l), __imag__ x); - } - else if (rcls == FP_INFINITE) - { - __real__ res = HUGE_VALL; - - if (icls >= FP_ZERO) - __imag__ res = __copysignl (signbit (__real__ x) ? M_PIl : 0.0, - __imag__ x); - else - __imag__ res = __nanl (""); - } - else - { - __real__ res = __nanl (""); - __imag__ res = __nanl (""); - } - } - else if (rcls == FP_ZERO && icls == FP_ZERO) - { - __real__ res = 0.0; - __imag__ res = __copysignl (M_PI_2l, __imag__ x); - } - else - { - __complex__ long double y; - - __real__ y = -__imag__ x; - __imag__ y = __real__ x; - - y = __kernel_casinhl (y, 1); - - if (signbit (__imag__ x)) - { - __real__ res = __real__ y; - __imag__ res = -__imag__ y; - } - else - { - __real__ res = -__real__ y; - __imag__ res = __imag__ y; - } - } - - return res; -} -weak_alias (__cacoshl, cacoshl) diff --git a/math/s_cacosl.c b/math/s_cacosl.c deleted file mode 100644 index 33858873e0..0000000000 --- a/math/s_cacosl.c +++ /dev/null @@ -1,54 +0,0 @@ -/* Return cosine 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 detai |
