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

Side by Side Diff: fusl/src/math/sinhf.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 "libm.h" 1 #include "libm.h"
2 2
3 float sinhf(float x) 3 float sinhf(float x) {
4 { 4 union {
5 » union {float f; uint32_t i;} u = {.f = x}; 5 float f;
6 » uint32_t w; 6 uint32_t i;
7 » float t, h, absx; 7 } u = {.f = x};
8 uint32_t w;
9 float t, h, absx;
8 10
9 » h = 0.5; 11 h = 0.5;
10 » if (u.i >> 31) 12 if (u.i >> 31)
11 » » h = -h; 13 h = -h;
12 » /* |x| */ 14 /* |x| */
13 » u.i &= 0x7fffffff; 15 u.i &= 0x7fffffff;
14 » absx = u.f; 16 absx = u.f;
15 » w = u.i; 17 w = u.i;
16 18
17 » /* |x| < log(FLT_MAX) */ 19 /* |x| < log(FLT_MAX) */
18 » if (w < 0x42b17217) { 20 if (w < 0x42b17217) {
19 » » t = expm1f(absx); 21 t = expm1f(absx);
20 » » if (w < 0x3f800000) { 22 if (w < 0x3f800000) {
21 » » » if (w < 0x3f800000 - (12<<23)) 23 if (w < 0x3f800000 - (12 << 23))
22 » » » » return x; 24 return x;
23 » » » return h*(2*t - t*t/(t+1)); 25 return h * (2 * t - t * t / (t + 1));
24 » » } 26 }
25 » » return h*(t + t/(t+1)); 27 return h * (t + t / (t + 1));
26 » } 28 }
27 29
28 » /* |x| > logf(FLT_MAX) or nan */ 30 /* |x| > logf(FLT_MAX) or nan */
29 » t = 2*h*__expo2f(absx); 31 t = 2 * h * __expo2f(absx);
30 » return t; 32 return t;
31 } 33 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698