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

Side by Side Diff: fusl/src/math/exp10f.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 #define _GNU_SOURCE 1 #define _GNU_SOURCE
2 #include <math.h> 2 #include <math.h>
3 #include <stdint.h> 3 #include <stdint.h>
4 #include "libc.h" 4 #include "libc.h"
5 5
6 float exp10f(float x) 6 float exp10f(float x) {
7 { 7 static const float p10[] = {1e-7f, 1e-6f, 1e-5f, 1e-4f, 1e-3f,
8 » static const float p10[] = { 8 1e-2f, 1e-1f, 1, 1e1, 1e2,
9 » » 1e-7f, 1e-6f, 1e-5f, 1e-4f, 1e-3f, 1e-2f, 1e-1f, 9 1e3, 1e4, 1e5, 1e6, 1e7};
10 » » 1, 1e1, 1e2, 1e3, 1e4, 1e5, 1e6, 1e7 10 float n, y = modff(x, &n);
11 » }; 11 union {
12 » float n, y = modff(x, &n); 12 float f;
13 » union {float f; uint32_t i;} u = {n}; 13 uint32_t i;
14 » /* fabsf(n) < 8 without raising invalid on nan */ 14 } u = {n};
15 » if ((u.i>>23 & 0xff) < 0x7f+3) { 15 /* fabsf(n) < 8 without raising invalid on nan */
16 » » if (!y) return p10[(int)n+7]; 16 if ((u.i >> 23 & 0xff) < 0x7f + 3) {
17 » » y = exp2f(3.32192809488736234787031942948939f * y); 17 if (!y)
18 » » return y * p10[(int)n+7]; 18 return p10[(int)n + 7];
19 » } 19 y = exp2f(3.32192809488736234787031942948939f * y);
20 » return exp2(3.32192809488736234787031942948939 * x); 20 return y * p10[(int)n + 7];
21 }
22 return exp2(3.32192809488736234787031942948939 * x);
21 } 23 }
22 24
23 weak_alias(exp10f, pow10f); 25 weak_alias(exp10f, pow10f);
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698