Index: fusl/src/math/cos.c |
diff --git a/fusl/src/math/cos.c b/fusl/src/math/cos.c |
index ee97f68bbb7be73e473e9324484bed533fcb39bb..fa5989e70b4f74ca0104dc83ebf2d7bff20a7e2b 100644 |
--- a/fusl/src/math/cos.c |
+++ b/fusl/src/math/cos.c |
@@ -42,36 +42,38 @@ |
#include "libm.h" |
-double cos(double x) |
-{ |
- double y[2]; |
- uint32_t ix; |
- unsigned n; |
+double cos(double x) { |
+ double y[2]; |
+ 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 (ix < 0x3e46a09e) { /* |x| < 2**-27 * sqrt(2) */ |
- /* raise inexact if x!=0 */ |
- FORCE_EVAL(x + 0x1p120f); |
- return 1.0; |
- } |
- return __cos(x, 0); |
- } |
+ /* |x| ~< pi/4 */ |
+ if (ix <= 0x3fe921fb) { |
+ if (ix < 0x3e46a09e) { /* |x| < 2**-27 * sqrt(2) */ |
+ /* raise inexact if x!=0 */ |
+ FORCE_EVAL(x + 0x1p120f); |
+ return 1.0; |
+ } |
+ return __cos(x, 0); |
+ } |
- /* cos(Inf or NaN) is NaN */ |
- if (ix >= 0x7ff00000) |
- return x-x; |
+ /* cos(Inf or NaN) is NaN */ |
+ if (ix >= 0x7ff00000) |
+ return x - x; |
- /* argument reduction */ |
- n = __rem_pio2(x, y); |
- switch (n&3) { |
- case 0: return __cos(y[0], y[1]); |
- case 1: return -__sin(y[0], y[1], 1); |
- case 2: return -__cos(y[0], y[1]); |
- default: |
- return __sin(y[0], y[1], 1); |
- } |
+ /* argument reduction */ |
+ n = __rem_pio2(x, y); |
+ switch (n & 3) { |
+ case 0: |
+ return __cos(y[0], y[1]); |
+ case 1: |
+ return -__sin(y[0], y[1], 1); |
+ case 2: |
+ return -__cos(y[0], y[1]); |
+ default: |
+ return __sin(y[0], y[1], 1); |
+ } |
} |