From 0ac5ae2335292908f39031b1ea9fe8edce433c0f Mon Sep 17 00:00:00 2001 From: Ulrich Drepper Date: Wed, 12 Oct 2011 11:27:51 -0400 Subject: Optimize libm libm is now somewhat integrated with gcc's -ffinite-math-only option and lots of the wrapper functions have been optimized. --- math/w_cosh.c | 31 +++++++++---------------------- 1 file changed, 9 insertions(+), 22 deletions(-) (limited to 'math/w_cosh.c') 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 , 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 #include -#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 -- cgit 1.4.1