Print this page
11210 libm should be cstyle(1ONBLD) clean
*** 16,36 ****
* 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.
*/
#pragma weak __sincosf = sincosf
! /* INDENT OFF */
/*
* For |x| < pi/4, let z = x * x, and approximate sin(x) by
*
* S(x) = x(S0 + S1*z)(S2 + S3*z + z*z)
* where
--- 16,38 ----
* 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.
*/
#pragma weak __sincosf = sincosf
!
/*
* For |x| < pi/4, let z = x * x, and approximate sin(x) by
*
* S(x) = x(S0 + S1*z)(S2 + S3*z + z*z)
* where
*** 50,65 ****
* C3 = 9.14499072605666582228127405245558035523741471271e+0002
* C4 = -3.63151270591815439197122504991683846785293207730e+0001
*
* with error bounded by |cos(x) - C(x)| < 2**(-34.2).
*/
- /* INDENT ON */
#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[] = {
--- 52,67 ----
* C3 = 9.14499072605666582228127405245558035523741471271e+0002
* C4 = -3.63151270591815439197122504991683846785293207730e+0001
*
* with error bounded by |cos(x) - C(x)| < 2**(-34.2).
*/
#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[] = {
*** 114,184 ****
#endif
*s = x;
*c = 1.0f;
return;
}
z = y * y;
! *s = (float)((y * (S0 + z * S1)) *
! (S2 + z * (S3 + z)));
! *c = (float)(((C0 + z * C1) + (z * z) * C2) *
! (C3 + z * (C4 + z)));
} else if (hx > 0) {
y = (y - pio2_1) - pio2_t;
z = y * y;
! *s = (float)(((C0 + z * C1) + (z * z) * C2) *
! (C3 + z * (C4 + z)));
! *c = (float)-((y * (S0 + z * S1)) *
! (S2 + z * (S3 + z)));
} else {
y = (y + pio2_1) + pio2_t;
z = y * y;
! *s = (float)-(((C0 + z * C1) + (z * z) * C2) *
! (C3 + z * (C4 + z)));
! *c = (float)((y * (S0 + z * S1)) *
! (S2 + z * (S3 + z)));
}
return;
} 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;
#if defined(__i386) && !defined(__amd64)
if (rp != fp_extended)
(void) __swapRP(rp);
#endif
} else {
if (ix >= 0x7f800000) {
*s = *c = x / x;
return;
}
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);
if (hy < 0) {
y = -y;
n = -n;
}
}
z = y * y;
f = (float)((y * (S0 + z * S1)) * (S2 + z * (S3 + z)));
! g = (float)(((C0 + z * C1) + (z * z) * C2) *
! (C3 + z * (C4 + z)));
if (n & 2) {
f = -f;
g = -g;
}
if (n & 1) {
*s = g;
*c = -f;
} else {
*s = f;
--- 116,191 ----
#endif
*s = x;
*c = 1.0f;
return;
}
+
z = y * y;
! *s = (float)((y * (S0 + z * S1)) * (S2 + z * (S3 + z)));
! *c = (float)(((C0 + z * C1) + (z * z) * C2) * (C3 + z *
! (C4 + z)));
} else if (hx > 0) {
y = (y - pio2_1) - pio2_t;
z = y * y;
! *s = (float)(((C0 + z * C1) + (z * z) * C2) * (C3 + z *
! (C4 + z)));
! *c = (float)-((y * (S0 + z * S1)) * (S2 + z * (S3 +
! z)));
} else {
y = (y + pio2_1) + pio2_t;
z = y * y;
! *s = (float)-(((C0 + z * C1) + (z * z) * C2) * (C3 + z *
! (C4 + z)));
! *c = (float)((y * (S0 + z * S1)) * (S2 + z * (S3 + z)));
}
+
return;
} 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;
#if defined(__i386) && !defined(__amd64)
if (rp != fp_extended)
(void) __swapRP(rp);
#endif
} else {
if (ix >= 0x7f800000) {
*s = *c = x / x;
return;
}
+
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);
+
if (hy < 0) {
y = -y;
n = -n;
}
}
z = y * y;
f = (float)((y * (S0 + z * S1)) * (S2 + z * (S3 + z)));
! g = (float)(((C0 + z * C1) + (z * z) * C2) * (C3 + z * (C4 + z)));
!
if (n & 2) {
f = -f;
g = -g;
}
+
if (n & 1) {
*s = g;
*c = -f;
} else {
*s = f;