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

Side by Side Diff: fusl/src/math/llrintl.c

Issue 1573973002: Add a "fork" of musl as //fusl. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 4 years, 11 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
« no previous file with comments | « fusl/src/math/llrintf.c ('k') | fusl/src/math/llround.c » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 #include <limits.h>
2 #include <fenv.h>
3 #include "libm.h"
4
5
6 #if LDBL_MANT_DIG == 53 && LDBL_MAX_EXP == 1024
7 long long llrintl(long double x)
8 {
9 return llrint(x);
10 }
11 #elif defined(FE_INEXACT)
12 /*
13 see comments in lrint.c
14
15 Note that if LLONG_MAX == 0x7fffffffffffffff && LDBL_MANT_DIG == 64
16 then x == 2**63 - 0.5 is the only input that overflows and
17 raises inexact (with tonearest or upward rounding mode)
18 */
19 long long llrintl(long double x)
20 {
21 #pragma STDC FENV_ACCESS ON
22 int e;
23
24 e = fetestexcept(FE_INEXACT);
25 x = rintl(x);
26 if (!e && (x > LLONG_MAX || x < LLONG_MIN))
27 feclearexcept(FE_INEXACT);
28 /* conversion */
29 return x;
30 }
31 #else
32 long long llrintl(long double x)
33 {
34 return rintl(x);
35 }
36 #endif
OLDNEW
« no previous file with comments | « fusl/src/math/llrintf.c ('k') | fusl/src/math/llround.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698