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.gz |
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 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__ long double -__cacosl (__complex__ long double x) -{ - __complex__ long double y; - __complex__ long 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 = __casinl (x); - - __real__ res = M_PI_2l - __real__ y; - if (__real__ res == 0.0L) - __real__ res = 0.0L; - __imag__ res = -__imag__ y; - } - else - { - __real__ y = -__imag__ x; - __imag__ y = __real__ x; - - y = __kernel_casinhl (y, 1); - - __real__ res = __imag__ y; - __imag__ res = __real__ y; - } - - return res; -} -weak_alias (__cacosl, cacosl) diff --git a/math/s_ccos.c b/math/s_ccos.c deleted file mode 100644 index e484551aee..0000000000 --- a/math/s_ccos.c +++ /dev/null @@ -1,40 +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 <fenv.h> -#include <math.h> -#include <math_private.h> - - -__complex__ double -__ccos (__complex__ double x) -{ - __complex__ double y; - - __real__ y = -__imag__ x; - __imag__ y = __real__ x; - - return __ccosh (y); -} -weak_alias (__ccos, ccos) -#ifdef NO_LONG_DOUBLE -strong_alias (__ccos, __ccosl) -weak_alias (__ccos, ccosl) -#endif diff --git a/math/s_ccos_template.c b/math/s_ccos_template.c index e484551aee..becaa2d27c 100644 --- a/math/s_ccos_template.c +++ b/math/s_ccos_template.c @@ -1,4 +1,4 @@ -/* Return cosine of complex double value. +/* Return cosine 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,19 +22,19 @@ #include <math.h> #include <math_private.h> - -__complex__ double -__ccos (__complex__ double x) +CFLOAT +M_DECL_FUNC (__ccos) (CFLOAT x) { - __complex__ double y; + CFLOAT y; __real__ y = -__imag__ x; __imag__ y = __real__ x; - return __ccosh (y); + return M_SUF (__ccosh) (y); } -weak_alias (__ccos, ccos) -#ifdef NO_LONG_DOUBLE -strong_alias (__ccos, __ccosl) -weak_alias (__ccos, ccosl) + +declare_mgen_alias (__ccos, ccos); + +#if M_LIBM_NEED_COMPAT (carg) +declare_mgen_libm_compat (__ccos, ccos) #endif diff --git a/math/s_ccosf.c b/math/s_ccosf.c deleted file mode 100644 index c7da3fe9ed..0000000000 --- a/math/s_ccosf.c +++ /dev/null @@ -1,38 +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 <fenv.h> -#include <math.h> -#include <math_private.h> - - -__complex__ float -__ccosf (__complex__ float x) -{ - __complex__ float y; - - __real__ y = -__imag__ x; - __imag__ y = __real__ x; - - return __ccoshf (y); -} -#ifndef __ccosf -weak_alias (__ccosf, ccosf) -#endif diff --git a/math/s_ccosh.c b/math/s_ccosh.c deleted file mode 100644 index 4c2f3008a3..0000000000 --- a/math/s_ccosh.c +++ /dev/null @@ -1,147 +0,0 @@ -/* Complex cosine 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 -__ccosh (__complex__ double x) -{ - __complex__ double retval; - int rcls = fpclassify (__real__ x); - int icls = fpclassify (__imag__ 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 (fabs (__real__ x) > t) - { - double exp_t = __ieee754_exp (t); - double rx = fabs (__real__ x); - if (signbit (__real__ x)) - sinix = -sinix; - 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_cosh (__real__ x) * cosix; - __imag__ retval = __ieee754_sinh (__real__ x) * sinix; - } - - math_check_force_underflow_complex (retval); - } - else - { - __imag__ retval = __real__ x == 0.0 ? 0.0 : __nan (""); - __real__ retval = __nan ("") + __nan (""); - - if (icls == FP_INFINITE) - 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) - * __copysign (1.0, __real__ x)); - } - else if (icls == FP_ZERO) - { - /* Imaginary part is 0.0. */ - __real__ retval = HUGE_VAL; - __imag__ retval = __imag__ x * __copysign (1.0, __real__ 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 (__ccosh, ccosh) -#ifdef NO_LONG_DOUBLE -strong_alias (__ccosh, __ccoshl) -weak_alias (__ccosh, ccoshl) -#endif diff --git a/math/s_ccosh_template.c b/math/s_ccosh_template.c index 4c2f3008a3..68de41d2da 100644 --- a/math/s_ccosh_template.c +++ b/math/s_ccosh_template.c @@ -1,4 +1,4 @@ -/* Complex cosine hyperbole function for double. +/* Complex cosine hyperbolic 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,10 +23,10 @@ #include <math_private.h> #include <float.h> -__complex__ double -__ccosh (__complex__ double x) +CFLOAT +M_DECL_FUNC (__ccosh) (CFLOAT x) { - __complex__ double retval; + CFLOAT retval; int rcls = fpclassify (__real__ x); int icls = fpclassify (__imag__ x); @@ -36,28 +36,28 @@ __ccosh (__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 (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)) sinix = -sinix; 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; @@ -67,28 +67,28 @@ __ccosh (__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_cosh (__real__ x) * cosix; - __imag__ retval = __ieee754_sinh (__real__ x) * sinix; + __real__ retval = M_COSH (__real__ x) * cosix; + __imag__ retval = M_SINH (__real__ x) * sinix; } math_check_force_underflow_complex (retval); } else { - __imag__ retval = __real__ x == 0.0 ? 0.0 : __nan (""); - __real__ retval = __nan ("") + __nan (""); + __imag__ retval = __real__ x == 0 ? 0 : M_NAN; + __real__ retval = M_NAN + M_NAN; if (icls == FP_INFINITE) feraiseexcept (FE_INVALID); @@ -100,33 +100,33 @@ __ccosh (__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) - * __copysign (1.0, __real__ x)); + __real__ retval = M_COPYSIGN (M_HUGE_VAL, cosix); + __imag__ retval = (M_COPYSIGN (M_HUGE_VAL, sinix) + * M_COPYSIGN (1, __real__ x)); } else if (icls == FP_ZERO) { /* Imaginary part is 0.0. */ - __real__ retval = HUGE_VAL; - __imag__ retval = __imag__ x * __copysign (1.0, __real__ x); + __real__ retval = M_HUGE_VAL; + __imag__ retval = __imag__ x * M_COPYSIGN (1, __real__ 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); @@ -134,14 +134,15 @@ __ccosh (__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 (__ccosh, ccosh) -#ifdef NO_LONG_DOUBLE -strong_alias (__ccosh, __ccoshl) -weak_alias (__ccosh, ccoshl) + +declare_mgen_alias (__ccosh, ccosh); + +#if M_LIBM_NEED_COMPAT (carg) +declare_mgen_libm_compat (__ccosh, ccosh) #endif diff --git a/math/s_ccoshf.c b/math/s_ccoshf.c deleted file mode 100644 index d572b76193..0000000000 --- a/math/s_ccoshf.c +++ /dev/null @@ -1,145 +0,0 @@ -/* Complex cosine 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 -__ccoshf (__complex__ float x) -{ - __complex__ float retval; - int rcls = fpclassify (__real__ x); - int icls = fpclassify (__imag__ 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 (fabsf (__real__ x) > t) - { - float exp_t = __ieee754_expf (t); - float rx = fabsf (__real__ x); - if (signbit (__real__ x)) - sinix = -sinix; - 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_coshf (__real__ x) * cosix; - __imag__ retval = __ieee754_sinhf (__real__ x) * sinix; - } - - math_check_force_underflow_complex (retval); - } - else - { - __imag__ retval = __real__ x == 0.0 ? 0.0 : __nanf (""); - __real__ retval = __nanf (""); - - if (icls == FP_INFINITE) - 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) - * __copysignf (1.0, __real__ x)); - } - else if (icls == FP_ZERO) - { - /* Imaginary part is 0.0. */ - __real__ retval = HUGE_VALF; - __imag__ retval = __imag__ x * __copysignf (1.0, __real__ 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 __ccoshf -weak_alias (__ccoshf, ccoshf) -#endif diff --git a/math/s_ccoshl.c b/math/s_ccoshl.c deleted file mode 100644 index d38f0aaff6..0000000000 --- a/math/s_ccoshl.c +++ /dev/null @@ -1,143 +0,0 @@ -/* Complex cosine 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 -__ccoshl (__complex__ long double x) -{ - __complex__ long double retval; - int rcls = fpclassify (__real__ x); - int icls = fpclassify (__imag__ 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 (fabsl (__real__ x) > t) - { - long double exp_t = __ieee754_expl (t); - long double rx = fabsl (__real__ x); - if (signbit (__real__ x)) - sinix = -sinix; - 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_coshl (__real__ x) * cosix; - __imag__ retval = __ieee754_sinhl (__real__ x) * sinix; - } - - math_check_force_underflow_complex (retval); - } - else - { - __imag__ retval = __real__ x == 0.0 ? 0.0 : __nanl (""); - __real__ retval = __nanl ("") + __nanl (""); - - if (icls == FP_INFINITE) - 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) - * __copysignl (1.0, __real__ x)); - } - else if (icls == FP_ZERO) - { - /* Imaginary part is 0.0. */ - __real__ retval = HUGE_VALL; - __imag__ retval = __imag__ x * __copysignl (1.0, __real__ 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 (__ccoshl, ccoshl) diff --git a/math/s_ccosl.c b/math/s_ccosl.c deleted file mode 100644 index 9e981147fc..0000000000 --- a/math/s_ccosl.c +++ /dev/null @@ -1,36 +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 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> - - -__complex__ long double -__ccosl (__complex__ long double x) -{ - __complex__ long double y; - - __real__ y = -__imag__ x; - __imag__ y = __real__ x; - - return __ccoshl (y); -} -weak_alias (__ccosl, ccosl) |