Skip to content

Commit e105d76

Browse files
authored
Apply suggestions from code review
1 parent 35bd457 commit e105d76

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1-
Workaround broken ``ldexp()`` implementation on Windows 10.
1+
`ldexp()` on Windows doesn't round subnormal results before Windows 11, but should. Python's :func:`math.ldexp` wrapper now does round them, so results may change
2+
slightly, in rare cases of very small results, on Windows versions before 11.

Modules/mathmodule.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2164,7 +2164,7 @@ math_ldexp_impl(PyObject *module, double x, PyObject *i)
21642164
errno = 0;
21652165
r = ldexp(x, (int)exp);
21662166
#ifdef _MSC_VER
2167-
if (-DBL_MIN < r && r < DBL_MIN) {
2167+
if (DBL_MIN > r && r > -DBL_MIN) {
21682168
/* Denormal (or zero) results can be incorrectly rounded here (rather,
21692169
truncated). Fixed in newer versions of the C runtime, included
21702170
with Windows 11. */

0 commit comments

Comments
 (0)