OLD | NEW |
1 #include <math.h> | 1 #include <math.h> |
2 #include <float.h> | 2 #include <float.h> |
3 #include "libm.h" | 3 #include "libm.h" |
4 | 4 |
5 #if LDBL_MANT_DIG == 53 && LDBL_MAX_EXP == 1024 | 5 #if LDBL_MANT_DIG == 53 && LDBL_MAX_EXP == 1024 |
6 long double nearbyintl(long double x) | 6 long double nearbyintl(long double x) { |
7 { | 7 return nearbyint(x); |
8 » return nearbyint(x); | |
9 } | 8 } |
10 #else | 9 #else |
11 #include <fenv.h> | 10 #include <fenv.h> |
12 long double nearbyintl(long double x) | 11 long double nearbyintl(long double x) { |
13 { | |
14 #ifdef FE_INEXACT | 12 #ifdef FE_INEXACT |
15 » PRAGMA_STDC_FENV_ACCESS_ON | 13 PRAGMA_STDC_FENV_ACCESS_ON |
16 » int e; | 14 int e; |
17 | 15 |
18 » e = fetestexcept(FE_INEXACT); | 16 e = fetestexcept(FE_INEXACT); |
19 #endif | 17 #endif |
20 » x = rintl(x); | 18 x = rintl(x); |
21 #ifdef FE_INEXACT | 19 #ifdef FE_INEXACT |
22 » if (!e) | 20 if (!e) |
23 » » feclearexcept(FE_INEXACT); | 21 feclearexcept(FE_INEXACT); |
24 #endif | 22 #endif |
25 » return x; | 23 return x; |
26 } | 24 } |
27 #endif | 25 #endif |
OLD | NEW |