summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Objects/longobject.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/Objects/longobject.c b/Objects/longobject.c
index e9e408d..c7608aa 100644
--- a/Objects/longobject.c
+++ b/Objects/longobject.c
@@ -1605,6 +1605,8 @@ long_true_divide(PyObject *v, PyObject *w)
aexp -= bexp;
if (aexp > INT_MAX / SHIFT)
goto overflow;
+ else if (aexp < -(INT_MAX / SHIFT))
+ return PyFloat_FromDouble(0.0); /* underflow to 0 */
errno = 0;
ad = ldexp(ad, aexp * SHIFT);
if (Py_OVERFLOWED(ad)) /* ignore underflow to 0.0 */