summaryrefslogtreecommitdiff
path: root/math/s_ccoshl.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_ccoshl.c
parentc196fed8f01a8599dd43edf1c7a1ea3ba9ed0598 (diff)
downloadglibc-bc62c2fb152d6ffec63975d88fd8f1bc3d3b7c01.tar.gz
Optimization to some complex math functions
Also, change last reference to __sqrt into __sqrt to easily.
Diffstat (limited to 'math/s_ccoshl.c')
-rw-r--r--math/s_ccoshl.c26
1 files changed, 11 insertions, 15 deletions
diff --git a/math/s_ccoshl.c b/math/s_ccoshl.c
index 1913bb6ee4..ed1bc459df 100644
--- a/math/s_ccoshl.c
+++ b/math/s_ccoshl.c
@@ -1,5 +1,5 @@
/* Complex cosine hyperbole function for long double.
- 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.
@@ -32,10 +32,10 @@ __ccoshl (__complex__ long double x)
int rcls = fpclassify (__real__ x);
int icls = fpclassify (__imag__ x);
- if (rcls >= FP_ZERO)
+ if (__builtin_expect (rcls >= FP_ZERO, 1))
{
/* Real part is finite. */
- if (icls >= FP_ZERO)
+ if (__builtin_expect (icls >= FP_ZERO, 1))
{
/* Imaginary part is finite. */
long double sinh_val = __ieee754_sinhl (__real__ x);
@@ -52,22 +52,14 @@ __ccoshl (__complex__ long double x)
__imag__ retval = __real__ x == 0.0 ? 0.0 : __nanl ("");
__real__ retval = __nanl ("") + __nanl ("");
-#ifdef FE_INVALID
if (icls == FP_INFINITE)
feraiseexcept (FE_INVALID);
-#endif
}
}
- else if (rcls == FP_INFINITE)
+ else if (__builtin_expect (rcls == FP_INFINITE, 1))
{
/* Real part is infinite. */
- if (icls == FP_ZERO)
- {
- /* Imaginary part is 0.0. */
- __real__ retval = HUGE_VALL;
- __imag__ retval = __imag__ x * __copysignl (1.0, __real__ x);
- }
- else if (icls > FP_ZERO)
+ if (__builtin_expect (icls > FP_ZERO, 1))
{
/* Imaginary part is finite. */
long double sinix, cosix;
@@ -78,16 +70,20 @@ __ccoshl (__complex__ long double x)
__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 ("");
-#ifdef FE_INVALID
if (icls == FP_INFINITE)
feraiseexcept (FE_INVALID);
-#endif
}
}
else