]> git.ipfire.org Git - thirdparty/glibc.git/blobdiff - math/s_ccos.c
Update copyright dates with scripts/update-copyrights.
[thirdparty/glibc.git] / math / s_ccos.c
index 63851aab5488c700b082a995b66c9ed59b45916c..cd0b2fe982d5cf70a49f4af60896a4cd10dbc365 100644 (file)
@@ -1,5 +1,5 @@
 /* Return cosine of complex double value.
-   Copyright (C) 1997, 2011 Free Software Foundation, Inc.
+   Copyright (C) 1997-2015 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
 
@@ -14,9 +14,8 @@
    Lesser General Public License for more details.
 
    You should have received a copy of the GNU Lesser General Public
-   License along with the GNU C Library; if not, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
+   License along with the GNU C Library; if not, see
+   <http://www.gnu.org/licenses/>.  */
 
 #include <complex.h>
 #include <fenv.h>
 __complex__ double
 __ccos (__complex__ double x)
 {
-  __complex__ double res;
+  __complex__ double y;
 
-  if (!isfinite (__real__ x) || __isnan (__imag__ x))
-    {
-      if (__real__ x == 0.0 || __imag__ x == 0.0)
-       {
-         __real__ res = __nan ("");
-         __imag__ res = 0.0;
+  __real__ y = -__imag__ x;
+  __imag__ y = __real__ x;
 
-#ifdef FE_INVALID
-         if (__isinf_ns (__real__ x))
-           feraiseexcept (FE_INVALID);
-#endif
-       }
-      else if (__isinf_ns (__imag__ x))
-       {
-         __real__ res = HUGE_VAL;
-         __imag__ res = __nan ("");
-
-#ifdef FE_INVALID
-         if (__isinf_ns (__real__ x))
-           feraiseexcept (FE_INVALID);
-#endif
-       }
-      else
-       {
-         __real__ res = __nan ("");
-         __imag__ res = __nan ("");
-
-#ifdef FE_INVALID
-         if (isfinite (__imag__ x))
-           feraiseexcept (FE_INVALID);
-#endif
-       }
-    }
-  else
-    {
-      __complex__ double y;
-
-      __real__ y = -__imag__ x;
-      __imag__ y = __real__ x;
-
-      res = __ccosh (y);
-    }
-
-  return res;
+  return __ccosh (y);
 }
 weak_alias (__ccos, ccos)
 #ifdef NO_LONG_DOUBLE