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.
*/
*** 98,110 ****
#include "libm.h"
extern const long double _TBL_expl_hi[], _TBL_expl_lo[];
extern const long double _TBL_expm1lx[], _TBL_expm1l[];
!
! static const long double
! zero = +0.0L,
one = +1.0L,
two = +2.0L,
ln2_64 = +1.083042469624914545964425189778400898568e-2L,
ovflthreshold = +1.135652340629414394949193107797076342845e+4L,
invln2_32 = +4.616624130844682903551758979206054839765e+1L,
--- 99,109 ----
#include "libm.h"
extern const long double _TBL_expl_hi[], _TBL_expl_lo[];
extern const long double _TBL_expm1lx[], _TBL_expm1l[];
! static const long double zero = +0.0L,
one = +1.0L,
two = +2.0L,
ln2_64 = +1.083042469624914545964425189778400898568e-2L,
ovflthreshold = +1.135652340629414394949193107797076342845e+4L,
invln2_32 = +4.616624130844682903551758979206054839765e+1L,
*** 125,182 ****
T3 = +6.613756613756613482074280932874221202424e-5L,
T4 = -1.653439153392139954169609822742235851120e-6L,
T5 = +4.175314851769539751387852116610973796053e-8L;
long double
! expm1l(long double x) {
int hx, ix, j, k, m;
long double t, r, s, w;
! hx = ((int *) &x)[HIXWORD];
ix = hx & ~0x80000000;
if (ix >= 0x7fff0000) {
if (x != x)
return (x + x); /* NaN */
if (x < zero)
return (-one); /* -inf */
return (x); /* +inf */
}
if (ix < 0x3fff4000) { /* |x| < 1.25 */
if (ix < 0x3ffb0000) { /* |x| < 0.0625 */
if (ix < 0x3f8d0000) {
! if ((int) x == 0)
return (x); /* |x|<2^-114 */
}
t = x * x;
r = (x - t * (P1 + t * (P2 + t * (P3 + t * (P4 + t *
(P5 + t * (P6 + t * P7)))))));
return (x + (x * r) / (two - r));
}
/* compute i = [64*x] */
m = 0x4009 - (ix >> 16);
j = ((ix & 0x0000ffff) | 0x10000) >> m; /* j=4,...,67 */
if (hx < 0)
j += 82; /* negative */
s = x - _TBL_expm1lx[j];
t = s * s;
r = s - t * (T1 + t * (T2 + t * (T3 + t * (T4 + t * T5))));
r = (s + s) / (two - r);
w = _TBL_expm1l[j];
return (w + (w + one) * r);
}
if (hx > 0) {
if (x > ovflthreshold)
return (huge * huge);
! k = (int) (invln2_32 * (x + ln2_64));
} else {
if (x < -80.0)
return (tiny - x / x);
! k = (int) (invln2_32 * (x - ln2_64));
}
j = k & 0x1f;
m = k >> 5;
! t = (long double) k;
x = (x - t * ln2_32hi) - t * ln2_32lo;
t = x * x;
r = (x - t * (T1 + t * (T2 + t * (T3 + t * (T4 + t * T5))))) - two;
x = _TBL_expl_hi[j] - ((_TBL_expl_hi[j] * (x + x)) / r -
_TBL_expl_lo[j]);
--- 124,194 ----
T3 = +6.613756613756613482074280932874221202424e-5L,
T4 = -1.653439153392139954169609822742235851120e-6L,
T5 = +4.175314851769539751387852116610973796053e-8L;
long double
! expm1l(long double x)
! {
int hx, ix, j, k, m;
long double t, r, s, w;
! hx = ((int *)&x)[HIXWORD];
ix = hx & ~0x80000000;
+
if (ix >= 0x7fff0000) {
if (x != x)
return (x + x); /* NaN */
+
if (x < zero)
return (-one); /* -inf */
+
return (x); /* +inf */
}
+
if (ix < 0x3fff4000) { /* |x| < 1.25 */
if (ix < 0x3ffb0000) { /* |x| < 0.0625 */
if (ix < 0x3f8d0000) {
! if ((int)x == 0)
return (x); /* |x|<2^-114 */
}
+
t = x * x;
r = (x - t * (P1 + t * (P2 + t * (P3 + t * (P4 + t *
(P5 + t * (P6 + t * P7)))))));
return (x + (x * r) / (two - r));
}
+
/* compute i = [64*x] */
m = 0x4009 - (ix >> 16);
j = ((ix & 0x0000ffff) | 0x10000) >> m; /* j=4,...,67 */
+
if (hx < 0)
j += 82; /* negative */
+
s = x - _TBL_expm1lx[j];
t = s * s;
r = s - t * (T1 + t * (T2 + t * (T3 + t * (T4 + t * T5))));
r = (s + s) / (two - r);
w = _TBL_expm1l[j];
return (w + (w + one) * r);
}
+
if (hx > 0) {
if (x > ovflthreshold)
return (huge * huge);
!
! k = (int)(invln2_32 * (x + ln2_64));
} else {
if (x < -80.0)
return (tiny - x / x);
!
! k = (int)(invln2_32 * (x - ln2_64));
}
+
j = k & 0x1f;
m = k >> 5;
! t = (long double)k;
x = (x - t * ln2_32hi) - t * ln2_32lo;
t = x * x;
r = (x - t * (T1 + t * (T2 + t * (T3 + t * (T4 + t * T5))))) - two;
x = _TBL_expl_hi[j] - ((_TBL_expl_hi[j] * (x + x)) / r -
_TBL_expl_lo[j]);