summaryrefslogtreecommitdiff
path: root/libc/math/s_ccos.c
diff options
context:
space:
mode:
Diffstat (limited to 'libc/math/s_ccos.c')
-rw-r--r--libc/math/s_ccos.c51
1 files changed, 6 insertions, 45 deletions
diff --git a/libc/math/s_ccos.c b/libc/math/s_ccos.c
index 1b244d707..4612eb33c 100644
--- a/libc/math/s_ccos.c
+++ b/libc/math/s_ccos.c
@@ -1,5 +1,5 @@
/* Return cosine of complex double value.
- Copyright (C) 1997 Free Software Foundation, Inc.
+ Copyright (C) 1997, 2011 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
@@ -21,57 +21,18 @@
#include <complex.h>
#include <fenv.h>
#include <math.h>
+#include <math_private.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 (__real__ x))
- feraiseexcept (FE_INVALID);
-#endif
- }
- else if (__isinf (__imag__ x))
- {
- __real__ res = HUGE_VAL;
- __imag__ res = __nan ("");
-
-#ifdef FE_INVALID
- if (__isinf (__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