mirror of
https://github.com/python/cpython.git
synced 2025-09-26 18:29:57 +00:00
Try to fix test_time.test_AsSecondsDouble() on "x86 Gentoo Non-Debug with X 3.x" buildbot
Use volatile keyword in _PyTime_Round()
This commit is contained in:
parent
350b51839a
commit
1efbebaac2
1 changed files with 8 additions and 3 deletions
|
@ -75,12 +75,17 @@ _PyTime_RoundHalfEven(double x)
|
||||||
static double
|
static double
|
||||||
_PyTime_Round(double x, _PyTime_round_t round)
|
_PyTime_Round(double x, _PyTime_round_t round)
|
||||||
{
|
{
|
||||||
|
/* volatile avoids optimization changing how numbers are rounded */
|
||||||
|
volatile double d;
|
||||||
|
|
||||||
|
d = x;
|
||||||
if (round == _PyTime_ROUND_HALF_EVEN)
|
if (round == _PyTime_ROUND_HALF_EVEN)
|
||||||
return _PyTime_RoundHalfEven(x);
|
d = _PyTime_RoundHalfEven(d);
|
||||||
else if (round == _PyTime_ROUND_CEILING)
|
else if (round == _PyTime_ROUND_CEILING)
|
||||||
return ceil(x);
|
d = ceil(d);
|
||||||
else
|
else
|
||||||
return floor(x);
|
d = floor(d);
|
||||||
|
return d;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue