about summary refs log tree commit diff
path: root/math/s_ccos.c
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@gmail.com>2011-10-22 00:32:39 -0400
committerUlrich Drepper <drepper@gmail.com>2011-10-22 00:32:39 -0400
commitbc62c2fb152d6ffec63975d88fd8f1bc3d3b7c01 (patch)
treebbb67e94ed1a9ba0becbe752c6853c199c639070 /math/s_ccos.c
parentc196fed8f01a8599dd43edf1c7a1ea3ba9ed0598 (diff)
downloadglibc-bc62c2fb152d6ffec63975d88fd8f1bc3d3b7c01.tar.gz
glibc-bc62c2fb152d6ffec63975d88fd8f1bc3d3b7c01.tar.xz
glibc-bc62c2fb152d6ffec63975d88fd8f1bc3d3b7c01.zip
Optimization to some complex math functions
Also, change last reference to __sqrt into __sqrt to easily.
Diffstat (limited to 'math/s_ccos.c')
-rw-r--r--math/s_ccos.c48
1 files changed, 4 insertions, 44 deletions
diff --git a/math/s_ccos.c b/math/s_ccos.c
index 63851aab54..4612eb33c3 100644
--- a/math/s_ccos.c
+++ b/math/s_ccos.c
@@ -27,52 +27,12 @@
 __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