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.
*/
*** 76,88 ****
*/
#include "libm.h"
extern const long double _TBL_logl_hi[], _TBL_logl_lo[];
!
! static const long double
! zero = 0.0L,
one = 1.0L,
two = 2.0L,
two113 = 10384593717069655257060992658440192.0L,
ln2hi = 6.931471805599453094172319547495844850203e-0001L,
ln2lo = 1.667085920830552208890449330400379754169e-0025L,
--- 77,87 ----
*/
#include "libm.h"
extern const long double _TBL_logl_hi[], _TBL_logl_lo[];
! static const long double zero = 0.0L,
one = 1.0L,
two = 2.0L,
two113 = 10384593717069655257060992658440192.0L,
ln2hi = 6.931471805599453094172319547495844850203e-0001L,
ln2lo = 1.667085920830552208890449330400379754169e-0025L,
*** 102,157 ****
B7 = 1.333333344463358756121456892645178795480e-0001L,
B8 = 1.176460904783899064854645174603360383792e-0001L,
B9 = 1.057293869956598995326368602518056990746e-0001L;
long double
! logl(long double x) {
long double f, s, z, qn, h, t;
! int *px = (int *) &x;
! int *pz = (int *) &z;
int i, j, ix, i0, i1, n;
/* get long double precision word ordering */
! if (*(int *) &one == 0) {
i0 = 3;
i1 = 0;
} else {
i0 = 0;
i1 = 3;
}
n = 0;
ix = px[i0];
if (ix > 0x3ffee0f8) { /* if x > 31/33 */
if (ix < 0x3fff1084) { /* if x < 33/31 */
f = x - one;
z = f * f;
! if (((ix - 0x3fff0000) | px[i1] | px[2] | px[1]) == 0) {
return (zero); /* log(1)= +0 */
! }
s = f / (two + f); /* |s|<2**-8 */
z = s * s;
! return (f - s * (f - z * (B1 + z * (B2 + z * (B3 +
! z * (B4 + z * (B5 + z * (B6 + z * (B7 +
! z * (B8 + z * B9))))))))));
}
if (ix >= 0x7fff0000)
return (x + x); /* x is +inf or NaN */
goto LARGE_N;
}
if (ix >= 0x00010000)
goto LARGE_N;
i = ix & 0x7fffffff;
if ((i | px[i1] | px[2] | px[1]) == 0) {
px[i0] |= 0x80000000;
return (one / x); /* log(0.0) = -inf */
}
if (ix < 0) {
! if ((unsigned) ix >= 0xffff0000)
return (x - x); /* x is -inf or NaN */
return (zero / zero); /* log(x<0) is NaN */
}
/* subnormal x */
x *= two113;
n = -113;
ix = px[i0];
LARGE_N:
--- 101,167 ----
B7 = 1.333333344463358756121456892645178795480e-0001L,
B8 = 1.176460904783899064854645174603360383792e-0001L,
B9 = 1.057293869956598995326368602518056990746e-0001L;
long double
! logl(long double x)
! {
long double f, s, z, qn, h, t;
! int *px = (int *)&x;
! int *pz = (int *)&z;
int i, j, ix, i0, i1, n;
/* get long double precision word ordering */
! if (*(int *)&one == 0) {
i0 = 3;
i1 = 0;
} else {
i0 = 0;
i1 = 3;
}
n = 0;
ix = px[i0];
+
if (ix > 0x3ffee0f8) { /* if x > 31/33 */
if (ix < 0x3fff1084) { /* if x < 33/31 */
f = x - one;
z = f * f;
!
! if (((ix - 0x3fff0000) | px[i1] | px[2] | px[1]) == 0)
return (zero); /* log(1)= +0 */
!
s = f / (two + f); /* |s|<2**-8 */
z = s * s;
! return (f - s * (f - z * (B1 + z * (B2 + z * (B3 + z *
! (B4 + z * (B5 + z * (B6 + z * (B7 + z * (B8 + z *
! B9))))))))));
}
+
if (ix >= 0x7fff0000)
return (x + x); /* x is +inf or NaN */
+
goto LARGE_N;
}
+
if (ix >= 0x00010000)
goto LARGE_N;
+
i = ix & 0x7fffffff;
+
if ((i | px[i1] | px[2] | px[1]) == 0) {
px[i0] |= 0x80000000;
return (one / x); /* log(0.0) = -inf */
}
+
if (ix < 0) {
! if ((unsigned)ix >= 0xffff0000)
return (x - x); /* x is -inf or NaN */
+
return (zero / zero); /* log(x<0) is NaN */
}
+
/* subnormal x */
x *= two113;
n = -113;
ix = px[i0];
LARGE_N:
*** 162,173 ****
pz[i0] = i & 0xfffffc00;
pz[i1] = pz[1] = pz[2] = 0;
s = (x - z) / (x + z);
j = (i >> 10) & 0x3f;
z = s * s;
! qn = (long double) n;
t = qn * ln2lo + _TBL_logl_lo[j];
h = qn * ln2hi + _TBL_logl_hi[j];
! f = t + s * (A1 + z * (A2 + z * (A3 + z * (A4 + z * (A5 +
! z * (A6 + z * A7))))));
return (h + f);
}
--- 172,183 ----
pz[i0] = i & 0xfffffc00;
pz[i1] = pz[1] = pz[2] = 0;
s = (x - z) / (x + z);
j = (i >> 10) & 0x3f;
z = s * s;
! qn = (long double)n;
t = qn * ln2lo + _TBL_logl_lo[j];
h = qn * ln2hi + _TBL_logl_hi[j];
! f = t + s * (A1 + z * (A2 + z * (A3 + z * (A4 + z * (A5 + z * (A6 + z *
! A7))))));
return (h + f);
}