Print this page
11210 libm should be cstyle(1ONBLD) clean
*** 16,28 ****
--- 16,30 ----
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
+
/*
* Copyright 2011 Nexenta Systems, Inc. All rights reserved.
*/
+
/*
* Copyright 2005 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
*** 34,43 ****
--- 36,46 ----
#include "libm.h"
extern const int _TBL_ipio2_inf[];
extern int __rem_pio2m(double *, double *, int, int, int, const int *);
+
#if defined(__i386) && !defined(__amd64)
extern int __swapRP(int);
#endif
static const double C[] = {
*** 90,148 ****
#ifdef lint
i = i;
#endif
return (1.0f);
}
z = y * y;
! return ((float)(((C0 + z * C1) + (z * z) * C2) *
! (C3 + z * (C4 + z))));
} else if (hx > 0) {
y = (y - pio2_1) - pio2_t;
z = y * y;
! return ((float)-((y * (S0 + z * S1)) *
! (S2 + z * (S3 + z))));
} else {
y = (y + pio2_1) + pio2_t;
z = y * y;
! return ((float)((y * (S0 + z * S1)) *
! (S2 + z * (S3 + z))));
}
} else if (ix <= 0x49c90fdb) { /* |x| < 2^19*pi */
#if defined(__i386) && !defined(__amd64)
int rp;
rp = __swapRP(fp_extended);
#endif
w = y * invpio2;
if (hx < 0)
n = (int)(w - half);
else
n = (int)(w + half);
y = (y - n * pio2_1) - n * pio2_t;
n++;
#if defined(__i386) && !defined(__amd64)
if (rp != fp_extended)
(void) __swapRP(rp);
#endif
} else {
if (ix >= 0x7f800000)
return (x / x); /* cos(Inf or NaN) is NaN */
hy = ((int *)&y)[HIWORD];
n = ((hy >> 20) & 0x7ff) - 1046;
((int *)&w)[HIWORD] = (hy & 0xfffff) | 0x41600000;
((int *)&w)[LOWORD] = ((int *)&y)[LOWORD];
n = __rem_pio2m(&w, &y, n, 1, 0, _TBL_ipio2_inf) + 1;
}
if (n & 1) {
/* compute cos y */
z = y * y;
! f = (float)(((C0 + z * C1) + (z * z) * C2) *
! (C3 + z * (C4 + z)));
} else {
/* compute sin y */
z = y * y;
f = (float)((y * (S0 + z * S1)) * (S2 + z * (S3 + z)));
}
! return ((n & 2)? -f : f);
}
--- 93,155 ----
#ifdef lint
i = i;
#endif
return (1.0f);
}
+
z = y * y;
! return ((float)(((C0 + z * C1) + (z * z) * C2) * (C3 +
! z * (C4 + z))));
} else if (hx > 0) {
y = (y - pio2_1) - pio2_t;
z = y * y;
! return ((float)-((y * (S0 + z * S1)) * (S2 + z * (S3 +
! z))));
} else {
y = (y + pio2_1) + pio2_t;
z = y * y;
! return ((float)((y * (S0 + z * S1)) * (S2 + z * (S3 +
! z))));
}
} else if (ix <= 0x49c90fdb) { /* |x| < 2^19*pi */
#if defined(__i386) && !defined(__amd64)
int rp;
rp = __swapRP(fp_extended);
#endif
w = y * invpio2;
+
if (hx < 0)
n = (int)(w - half);
else
n = (int)(w + half);
+
y = (y - n * pio2_1) - n * pio2_t;
n++;
#if defined(__i386) && !defined(__amd64)
if (rp != fp_extended)
(void) __swapRP(rp);
#endif
} else {
if (ix >= 0x7f800000)
return (x / x); /* cos(Inf or NaN) is NaN */
+
hy = ((int *)&y)[HIWORD];
n = ((hy >> 20) & 0x7ff) - 1046;
((int *)&w)[HIWORD] = (hy & 0xfffff) | 0x41600000;
((int *)&w)[LOWORD] = ((int *)&y)[LOWORD];
n = __rem_pio2m(&w, &y, n, 1, 0, _TBL_ipio2_inf) + 1;
}
if (n & 1) {
/* compute cos y */
z = y * y;
! f = (float)(((C0 + z * C1) + (z * z) * C2) * (C3 + z * (C4 +
! z)));
} else {
/* compute sin y */
z = y * y;
f = (float)((y * (S0 + z * S1)) * (S2 + z * (S3 + z)));
}
! return ((n & 2) ? -f : f);
}