Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 11 additions & 11 deletions Objects/floatobject.c
Original file line number Diff line number Diff line change
Expand Up @@ -641,7 +641,7 @@ _float_div_mod(double vx, double wx, double *floordiv, double *mod)
*floordiv = floor(div);
if (div - *floordiv > 0.5) {
*floordiv += 1.0;
}
}
}
else {
/* div is zero - get the same sign as the true quotient */
Expand All @@ -652,16 +652,16 @@ _float_div_mod(double vx, double wx, double *floordiv, double *mod)
static PyObject *
float_divmod(PyObject *v, PyObject *w)
{
double vx, wx;
double mod, floordiv;
CONVERT_TO_DOUBLE(v, vx);
CONVERT_TO_DOUBLE(w, wx);
if (wx == 0.0) {
PyErr_SetString(PyExc_ZeroDivisionError, "float divmod()");
return NULL;
}
_float_div_mod(vx, wx, &floordiv, &mod);
return Py_BuildValue("(dd)", floordiv, mod);
double vx, wx;
double mod, floordiv;
CONVERT_TO_DOUBLE(v, vx);
CONVERT_TO_DOUBLE(w, wx);
if (wx == 0.0) {
PyErr_SetString(PyExc_ZeroDivisionError, "float divmod()");
return NULL;
}
_float_div_mod(vx, wx, &floordiv, &mod);
return Py_BuildValue("(dd)", floordiv, mod);
}

static PyObject *
Expand Down