Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(131)

Unified Diff: fusl/src/math/cos.c

Issue 1714623002: [fusl] clang-format fusl (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: headers too Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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);
+ }
}

Powered by Google App Engine
This is Rietveld 408576698