about summary refs log tree commit diff
path: root/math/s_ccosh.c
diff options
context:
space:
mode:
Diffstat (limited to 'math/s_ccosh.c')
-rw-r--r--math/s_ccosh.c24
1 files changed, 10 insertions, 14 deletions
diff --git a/math/s_ccosh.c b/math/s_ccosh.c
index 83aa025d42..c10e5d899f 100644
--- a/math/s_ccosh.c
+++ b/math/s_ccosh.c
@@ -1,5 +1,5 @@
 /* Complex cosine hyperbole function for 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 @@ __ccosh (__complex__ 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.  */
 	  double sinh_val = __ieee754_sinh (__real__ x);
@@ -52,22 +52,14 @@ __ccosh (__complex__ double x)
 	  __imag__ retval = __real__ x == 0.0 ? 0.0 : __nan ("");
 	  __real__ retval = __nan ("") + __nan ("");
 
-#ifdef FE_INVALID
 	  if (icls == FP_INFINITE)
 	    feraiseexcept (FE_INVALID);
-#endif
 	}
     }
   else if (rcls == FP_INFINITE)
     {
       /* Real part is infinite.  */
-      if (icls == FP_ZERO)
-	{
-	  /* Imaginary part is 0.0.  */
-	  __real__ retval = HUGE_VAL;
-	  __imag__ retval = __imag__ x * __copysign (1.0, __real__ x);
-	}
-      else if (icls > FP_ZERO)
+      if (__builtin_expect (icls > FP_ZERO, 1))
 	{
 	  /* Imaginary part is finite.  */
 	  double sinix, cosix;
@@ -78,16 +70,20 @@ __ccosh (__complex__ double x)
 	  __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 ("");
 
-#ifdef FE_INVALID
 	  if (icls == FP_INFINITE)
 	    feraiseexcept (FE_INVALID);
-#endif
 	}
     }
   else