diff options
author | Tim Peters <tim.peters@gmail.com> | 2001-12-11 19:57:24 (GMT) |
---|---|---|
committer | Tim Peters <tim.peters@gmail.com> | 2001-12-11 19:57:24 (GMT) |
commit | 63a3571e1732176e0e784e0d0e6dac07c9162611 (patch) | |
tree | 971be7d110b1b8cb795f6ecbe00f88761719140f /Objects/floatobject.c | |
parent | 54e629419738bb12650428174e2d908cf150e4f7 (diff) | |
download | cpython-63a3571e1732176e0e784e0d0e6dac07c9162611.zip cpython-63a3571e1732176e0e784e0d0e6dac07c9162611.tar.gz cpython-63a3571e1732176e0e784e0d0e6dac07c9162611.tar.bz2 |
float_int_div(): For clarity, move this closer to the other float
division functions, and rename to float_floor_div.
Diffstat (limited to 'Objects/floatobject.c')
-rw-r--r-- | Objects/floatobject.c | 32 |
1 files changed, 16 insertions, 16 deletions
diff --git a/Objects/floatobject.c b/Objects/floatobject.c index ea162df..8ce0ff5 100644 --- a/Objects/floatobject.c +++ b/Objects/floatobject.c @@ -514,6 +514,21 @@ float_divmod(PyObject *v, PyObject *w) } 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) { double iv, iw, ix; @@ -569,21 +584,6 @@ float_pow(PyObject *v, PyObject *w, PyObject *z) } 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) { return PyFloat_FromDouble(-v->ob_fval); @@ -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 */ |