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