Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 4e8ab5d

Browse files
committed
float_divmod(): the code wasn't sick enough to stop the MS optimizer
from optimizing away mod's sign adjustment when mod == 0; so it got the intended result only in the debug build.
1 parent 95837f1 commit 4e8ab5d

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

Objects/floatobject.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -476,7 +476,7 @@ float_divmod(PyObject *v, PyObject *w)
476476
fmod returns different results across platforms; ensure
477477
it has the same sign as the denominator; we'd like to do
478478
"mod = wx * 0.0", but that may get optimized away */
479-
mod = 0.0;
479+
mod *= mod; /* hide "mod = +0" from optimizer */
480480
if (wx < 0.0)
481481
mod = -mod;
482482
}

0 commit comments

Comments
 (0)