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

Side by Side Diff: fusl/src/math/lrintl.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 <limits.h> 1 #include <limits.h>
2 #include <fenv.h> 2 #include <fenv.h>
3 #include "libm.h" 3 #include "libm.h"
4 4
5
6 #if LDBL_MANT_DIG == 53 && LDBL_MAX_EXP == 1024 5 #if LDBL_MANT_DIG == 53 && LDBL_MAX_EXP == 1024
7 long lrintl(long double x) 6 long lrintl(long double x) {
8 { 7 return lrint(x);
9 » return lrint(x);
10 } 8 }
11 #elif defined(FE_INEXACT) 9 #elif defined(FE_INEXACT)
12 /* 10 /*
13 see comments in lrint.c 11 see comments in lrint.c
14 12
15 Note that if LONG_MAX == 0x7fffffffffffffff && LDBL_MANT_DIG == 64 13 Note that if LONG_MAX == 0x7fffffffffffffff && LDBL_MANT_DIG == 64
16 then x == 2**63 - 0.5 is the only input that overflows and 14 then x == 2**63 - 0.5 is the only input that overflows and
17 raises inexact (with tonearest or upward rounding mode) 15 raises inexact (with tonearest or upward rounding mode)
18 */ 16 */
19 long lrintl(long double x) 17 long lrintl(long double x) {
20 { 18 PRAGMA_STDC_FENV_ACCESS_ON
21 » PRAGMA_STDC_FENV_ACCESS_ON 19 int e;
22 » int e;
23 20
24 » e = fetestexcept(FE_INEXACT); 21 e = fetestexcept(FE_INEXACT);
25 » x = rintl(x); 22 x = rintl(x);
26 » if (!e && (x > LONG_MAX || x < LONG_MIN)) 23 if (!e && (x > LONG_MAX || x < LONG_MIN))
27 » » feclearexcept(FE_INEXACT); 24 feclearexcept(FE_INEXACT);
28 » /* conversion */ 25 /* conversion */
29 » return x; 26 return x;
30 } 27 }
31 #else 28 #else
32 long lrintl(long double x) 29 long lrintl(long double x) {
33 { 30 return rintl(x);
34 » return rintl(x);
35 } 31 }
36 #endif 32 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698