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

Side by Side Diff: fusl/src/math/scalbn.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 unified diff | Download patch
OLDNEW
1 #include <math.h> 1 #include <math.h>
2 #include <stdint.h> 2 #include <stdint.h>
3 3
4 double scalbn(double x, int n) 4 double scalbn(double x, int n) {
5 { 5 union {
6 » union {double f; uint64_t i;} u; 6 double f;
7 » double_t y = x; 7 uint64_t i;
8 } u;
9 double_t y = x;
8 10
9 » if (n > 1023) { 11 if (n > 1023) {
10 » » y *= 0x1p1023; 12 y *= 0x1p1023;
11 » » n -= 1023; 13 n -= 1023;
12 » » if (n > 1023) { 14 if (n > 1023) {
13 » » » y *= 0x1p1023; 15 y *= 0x1p1023;
14 » » » n -= 1023; 16 n -= 1023;
15 » » » if (n > 1023) 17 if (n > 1023)
16 » » » » n = 1023; 18 n = 1023;
17 » » } 19 }
18 » } else if (n < -1022) { 20 } else if (n < -1022) {
19 » » y *= 0x1p-1022; 21 y *= 0x1p-1022;
20 » » n += 1022; 22 n += 1022;
21 » » if (n < -1022) { 23 if (n < -1022) {
22 » » » y *= 0x1p-1022; 24 y *= 0x1p-1022;
23 » » » n += 1022; 25 n += 1022;
24 » » » if (n < -1022) 26 if (n < -1022)
25 » » » » n = -1022; 27 n = -1022;
26 » » } 28 }
27 » } 29 }
28 » u.i = (uint64_t)(0x3ff+n)<<52; 30 u.i = (uint64_t)(0x3ff + n) << 52;
29 » x = y * u.f; 31 x = y * u.f;
30 » return x; 32 return x;
31 } 33 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698