diff options
author | Ulrich Drepper <drepper@gmail.com> | 2011-10-12 11:27:51 -0400 |
---|---|---|
committer | Ulrich Drepper <drepper@gmail.com> | 2011-10-12 11:27:51 -0400 |
commit | 0ac5ae2335292908f39031b1ea9fe8edce433c0f (patch) | |
tree | f9d26c8abc0de39d18d4c13e70f6022cdc6b461f /math/w_cosh.c | |
parent | a843a204a3e8a0dd53584dad3668771abaec84ac (diff) | |
download | glibc-0ac5ae2335292908f39031b1ea9fe8edce433c0f.zip glibc-0ac5ae2335292908f39031b1ea9fe8edce433c0f.tar.gz glibc-0ac5ae2335292908f39031b1ea9fe8edce433c0f.tar.bz2 |
Optimize libm
libm is now somewhat integrated with gcc's -ffinite-math-only option
and lots of the wrapper functions have been optimized.
Diffstat (limited to 'math/w_cosh.c')
-rw-r--r-- | math/w_cosh.c | 31 |
1 files changed, 9 insertions, 22 deletions
diff --git a/math/w_cosh.c b/math/w_cosh.c index 0e27a2d..5701078 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 |