| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -75,12 +75,17 @@ _PyTime_RoundHalfEven(double x) | |||
| 75 | 75 | static double | |
| 76 | 76 | _PyTime_Round(double x, _PyTime_round_t round) | |
| 77 | 77 | { | |
| 78 | + /* volatile avoids optimization changing how numbers are rounded */ | ||
| 79 | + volatile double d; | ||
| 80 | + | ||
| 81 | + d = x; | ||
| 78 | 82 | if (round == _PyTime_ROUND_HALF_EVEN) | |
| 79 | - return _PyTime_RoundHalfEven(x); | ||
| 83 | + d = _PyTime_RoundHalfEven(d); | ||
| 80 | 84 | else if (round == _PyTime_ROUND_CEILING) | |
| 81 | - return ceil(x); | ||
| 85 | + d = ceil(d); | ||
| 82 | 86 | else | |
| 83 | - return floor(x); | ||
| 87 | + d = floor(d); | ||
| 88 | + return d; | ||
| 84 | 89 | } | |
| 85 | 90 | ||
| 86 | 91 | static int | |
| Back | FazBrowse Home | New Git URL |
0 commit comments