float_int_div(): For clarity, move this closer to the other float

division functions, and rename to float_floor_div.
This commit is contained in:
Tim Peters 2001-12-11 19:57:24 +00:00
parent 54e6294197
commit 63a3571e17
1 changed files with 16 additions and 16 deletions

View File

@ -513,6 +513,21 @@ float_divmod(PyObject *v, PyObject *w)
return Py_BuildValue("(dd)", floordiv, mod);
}
static PyObject *
float_floor_div(PyObject *v, PyObject *w)
{
PyObject *t, *r;
t = float_divmod(v, w);
if (t != NULL) {
r = PyTuple_GET_ITEM(t, 0);
Py_INCREF(r);
Py_DECREF(t);
return r;
}
return NULL;
}
static PyObject *
float_pow(PyObject *v, PyObject *w, PyObject *z)
{
@ -568,21 +583,6 @@ float_pow(PyObject *v, PyObject *w, PyObject *z)
return PyFloat_FromDouble(ix);
}
static PyObject *
float_int_div(PyObject *v, PyObject *w)
{
PyObject *t, *r;
t = float_divmod(v, w);
if (t != NULL) {
r = PyTuple_GET_ITEM(t, 0);
Py_INCREF(r);
Py_DECREF(t);
return r;
}
return NULL;
}
static PyObject *
float_neg(PyFloatObject *v)
{
@ -757,7 +757,7 @@ static PyNumberMethods float_as_number = {
0, /* nb_inplace_and */
0, /* nb_inplace_xor */
0, /* nb_inplace_or */
float_int_div, /* nb_floor_divide */
float_floor_div, /* nb_floor_divide */
float_div, /* nb_true_divide */
0, /* nb_inplace_floor_divide */
0, /* nb_inplace_true_divide */