| Index: fusl/src/math/sincos.c
|
| diff --git a/fusl/src/math/sincos.c b/fusl/src/math/sincos.c
|
| index 35b2d923968f1b5deaaf7e4183c288c2d2a05043..33d74fcea205c6dab0c2770212c458f37eacbeb3 100644
|
| --- a/fusl/src/math/sincos.c
|
| +++ b/fusl/src/math/sincos.c
|
| @@ -13,57 +13,56 @@
|
| #define _GNU_SOURCE
|
| #include "libm.h"
|
|
|
| -void sincos(double x, double *sin, double *cos)
|
| -{
|
| - double y[2], s, c;
|
| - uint32_t ix;
|
| - unsigned n;
|
| +void sincos(double x, double* sin, double* cos) {
|
| + double y[2], s, c;
|
| + uint32_t ix;
|
| + unsigned n;
|
|
|
| - GET_HIGH_WORD(ix, x);
|
| - ix &= 0x7fffffff;
|
| + GET_HIGH_WORD(ix, x);
|
| + ix &= 0x7fffffff;
|
|
|
| - /* |x| ~< pi/4 */
|
| - if (ix <= 0x3fe921fb) {
|
| - /* if |x| < 2**-27 * sqrt(2) */
|
| - if (ix < 0x3e46a09e) {
|
| - /* raise inexact if x!=0 and underflow if subnormal */
|
| - FORCE_EVAL(ix < 0x00100000 ? x/0x1p120f : x+0x1p120f);
|
| - *sin = x;
|
| - *cos = 1.0;
|
| - return;
|
| - }
|
| - *sin = __sin(x, 0.0, 0);
|
| - *cos = __cos(x, 0.0);
|
| - return;
|
| - }
|
| + /* |x| ~< pi/4 */
|
| + if (ix <= 0x3fe921fb) {
|
| + /* if |x| < 2**-27 * sqrt(2) */
|
| + if (ix < 0x3e46a09e) {
|
| + /* raise inexact if x!=0 and underflow if subnormal */
|
| + FORCE_EVAL(ix < 0x00100000 ? x / 0x1p120f : x + 0x1p120f);
|
| + *sin = x;
|
| + *cos = 1.0;
|
| + return;
|
| + }
|
| + *sin = __sin(x, 0.0, 0);
|
| + *cos = __cos(x, 0.0);
|
| + return;
|
| + }
|
|
|
| - /* sincos(Inf or NaN) is NaN */
|
| - if (ix >= 0x7ff00000) {
|
| - *sin = *cos = x - x;
|
| - return;
|
| - }
|
| + /* sincos(Inf or NaN) is NaN */
|
| + if (ix >= 0x7ff00000) {
|
| + *sin = *cos = x - x;
|
| + return;
|
| + }
|
|
|
| - /* argument reduction needed */
|
| - n = __rem_pio2(x, y);
|
| - s = __sin(y[0], y[1], 1);
|
| - c = __cos(y[0], y[1]);
|
| - switch (n&3) {
|
| - case 0:
|
| - *sin = s;
|
| - *cos = c;
|
| - break;
|
| - case 1:
|
| - *sin = c;
|
| - *cos = -s;
|
| - break;
|
| - case 2:
|
| - *sin = -s;
|
| - *cos = -c;
|
| - break;
|
| - case 3:
|
| - default:
|
| - *sin = -c;
|
| - *cos = s;
|
| - break;
|
| - }
|
| + /* argument reduction needed */
|
| + n = __rem_pio2(x, y);
|
| + s = __sin(y[0], y[1], 1);
|
| + c = __cos(y[0], y[1]);
|
| + switch (n & 3) {
|
| + case 0:
|
| + *sin = s;
|
| + *cos = c;
|
| + break;
|
| + case 1:
|
| + *sin = c;
|
| + *cos = -s;
|
| + break;
|
| + case 2:
|
| + *sin = -s;
|
| + *cos = -c;
|
| + break;
|
| + case 3:
|
| + default:
|
| + *sin = -c;
|
| + *cos = s;
|
| + break;
|
| + }
|
| }
|
|
|