Thanks to visit codestin.com Credit goes to github.com
We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 350b518 commit 1efbebaCopy full SHA for 1efbeba
1 file changed
Python/pytime.c
@@ -75,12 +75,17 @@ _PyTime_RoundHalfEven(double x)
75
static double
76
_PyTime_Round(double x, _PyTime_round_t round)
77
{
78
+ /* volatile avoids optimization changing how numbers are rounded */
79
+ volatile double d;
80
+
81
+ d = x;
82
if (round == _PyTime_ROUND_HALF_EVEN)
- return _PyTime_RoundHalfEven(x);
83
+ d = _PyTime_RoundHalfEven(d);
84
else if (round == _PyTime_ROUND_CEILING)
- return ceil(x);
85
+ d = ceil(d);
86
else
- return floor(x);
87
+ d = floor(d);
88
+ return d;
89
}
90
91
static int
0 commit comments