Print this page
11210 libm should be cstyle(1ONBLD) clean
*** 20,29 ****
--- 20,30 ----
*/
/*
* Copyright 2011 Nexenta Systems, Inc. All rights reserved.
*/
+
/*
* Copyright 2006 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
*** 58,100 ****
*/
#include "libm.h"
#include "longdouble.h"
! static const long double small = 1.0e-20L, one = 1.0, two = 2.0,
#ifndef lint
big = 1.0e+20L,
#endif
threshold = 45.0L;
long double
! tanhl(long double x) {
long double t, y, z;
int signx;
#ifndef lint
volatile long double dummy __unused;
#endif
if (isnanl(x))
return (x + x); /* x is NaN */
signx = signbitl(x);
t = fabsl(x);
z = one;
if (t <= threshold) {
! if (t > one)
z = one - two / (expm1l(t + t) + two);
! else if (t > small) {
y = expm1l(-t - t);
z = -y / (y + two);
} else {
#ifndef lint
dummy = t + big;
/* inexact if t != 0 */
#endif
return (x);
}
! } else if (!finitel(t))
return (copysignl(one, x));
! else
return (signx ? -z + small * small : z - small * small);
return (signx ? -z : z);
}
--- 59,109 ----
*/
#include "libm.h"
#include "longdouble.h"
! static const long double small = 1.0e-20L,
! one = 1.0,
! two = 2.0,
#ifndef lint
big = 1.0e+20L,
#endif
threshold = 45.0L;
long double
! tanhl(long double x)
! {
long double t, y, z;
int signx;
+
#ifndef lint
volatile long double dummy __unused;
#endif
if (isnanl(x))
return (x + x); /* x is NaN */
+
signx = signbitl(x);
t = fabsl(x);
z = one;
+
if (t <= threshold) {
! if (t > one) {
z = one - two / (expm1l(t + t) + two);
! } else if (t > small) {
y = expm1l(-t - t);
z = -y / (y + two);
} else {
#ifndef lint
dummy = t + big;
/* inexact if t != 0 */
#endif
return (x);
}
! } else if (!finitel(t)) {
return (copysignl(one, x));
! } else {
return (signx ? -z + small * small : z - small * small);
+ }
+
return (signx ? -z : z);
}