about summary refs log tree commit diff
path: root/math/w_cosh.c
diff options
context:
space:
mode:
Diffstat (limited to 'math/w_cosh.c')
-rw-r--r--math/w_cosh.c31
1 files changed, 9 insertions, 22 deletions
diff --git a/math/w_cosh.c b/math/w_cosh.c
index 0e27a2da1c..57010781bf 100644
--- a/math/w_cosh.c
+++ b/math/w_cosh.c
@@ -1,4 +1,4 @@
-/* @(#)w_cosh.c 5.1 93/09/24 */
+/* Optimizations bu Ulrich Drepper <drepper@gmail.com>, 2011 */
 /*
  * ====================================================
  * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
@@ -10,10 +10,6 @@
  * ====================================================
  */
 
-#if defined(LIBM_SCCS) && !defined(lint)
-static char rcsid[] = "$NetBSD: w_cosh.c,v 1.6 1995/05/10 20:48:47 jtc Exp $";
-#endif
-
 /*
  * wrapper cosh(x)
  */
@@ -21,24 +17,15 @@ static char rcsid[] = "$NetBSD: w_cosh.c,v 1.6 1995/05/10 20:48:47 jtc Exp $";
 #include <math.h>
 #include <math_private.h>
 
-#ifdef __STDC__
-	double __cosh(double x)		/* wrapper cosh */
-#else
-	double __cosh(x)			/* wrapper cosh */
-	double x;
-#endif
+double
+__cosh (double x)
 {
-#ifdef _IEEE_LIBM
-	return __ieee754_cosh(x);
-#else
-	double z;
-	z = __ieee754_cosh(x);
-	if(_LIB_VERSION == _IEEE_ || __isnan(x)) return z;
-	if(!__finite(z) && __finite(x)) {
-	        return __kernel_standard(x,x,5); /* cosh overflow */
-	} else
-	    return z;
-#endif
+	double z = __ieee754_cosh (x);
+	if (__builtin_expect (!__finite (z), 0) && __finite (x)
+	    && _LIB_VERSION != _IEEE_)
+		return __kernel_standard (x, x, 5); /* cosh overflow */
+
+	return z;
 }
 weak_alias (__cosh, cosh)
 #ifdef NO_LONG_DOUBLE