Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 #include <fenv.h> | 1 #include <fenv.h> |
| 2 #include <math.h> | 2 #include <math.h> |
| 3 #include "libm.h" | |
| 3 | 4 |
| 4 float nearbyintf(float x) | 5 float nearbyintf(float x) |
| 5 { | 6 { |
| 6 #ifdef FE_INEXACT | 7 #ifdef FE_INEXACT |
| 7 » #pragma STDC FENV_ACCESS ON | 8 » PRAGMA_STDC_FENV_ACCESS_ON |
| 8 int e; | 9 int e; |
| 9 | 10 |
| 10 e = fetestexcept(FE_INEXACT); | 11 e = fetestexcept(FE_INEXACT); |
| 11 #endif | 12 #endif |
| 12 x = rintf(x); | 13 x = rintf(x); |
| 13 #ifdef FE_INEXACT | 14 #ifdef FE_INEXACT |
| 14 if (!e) | 15 if (!e) |
| 15 feclearexcept(FE_INEXACT); | 16 feclearexcept(FE_INEXACT); |
| 16 #endif | 17 #endif |
| 17 return x; | 18 return x; |
| 18 } | 19 } |
| OLD | NEW |