X-Git-Url: http://nsz.repo.hu/git/?a=blobdiff_plain;f=src%2Fmath%2Ftanhl.c;h=92efb20dd580cec4ac11bade4fd54185d1ab3cf9;hb=04ccbdca6d88738e23e0d6a622ad33854c468646;hp=e62be59b26308f916fc73e93a310e6c8048d59e5;hpb=b69f695acedd4ce2798ef9ea28d834ceccc789bd;p=musl diff --git a/src/math/tanhl.c b/src/math/tanhl.c index e62be59b..92efb20d 100644 --- a/src/math/tanhl.c +++ b/src/math/tanhl.c @@ -41,7 +41,7 @@ long double tanhl(long double x) return tanh(x); } #elif LDBL_MANT_DIG == 64 && LDBL_MAX_EXP == 16384 -static const long double one=1.0, two=2.0, tiny = 1.0e-4900L; +static const long double tiny = 1.0e-4900L; long double tanhl(long double x) { @@ -57,8 +57,8 @@ long double tanhl(long double x) if (ix == 0x7fff) { /* for NaN it's not important which branch: tanhl(NaN) = NaN */ if (se & 0x8000) - return one/x-one; /* tanhl(-inf)= -1; */ - return one/x+one; /* tanhl(+inf)= +1 */ + return 1.0/x-1.0; /* tanhl(-inf)= -1; */ + return 1.0/x+1.0; /* tanhl(+inf)= +1 */ } /* |x| < 23 */ @@ -66,17 +66,17 @@ long double tanhl(long double x) if ((ix|jj0|jj1) == 0) /* x == +- 0 */ return x; if (ix < 0x3fc8) /* |x| < 2**-55 */ - return x*(one+tiny); /* tanh(small) = small */ + return x*(1.0+tiny); /* tanh(small) = small */ if (ix >= 0x3fff) { /* |x| >= 1 */ - t = expm1l(two*fabsl(x)); - z = one - two/(t+two); + t = expm1l(2.0*fabsl(x)); + z = 1.0 - 2.0/(t+2.0); } else { - t = expm1l(-two*fabsl(x)); - z = -t/(t+two); + t = expm1l(-2.0*fabsl(x)); + z = -t/(t+2.0); } /* |x| > 23, return +-1 */ } else { - z = one - tiny; /* raise inexact flag */ + z = 1.0 - tiny; /* raise inexact flag */ } return se & 0x8000 ? -z : z; }