summaryrefslogtreecommitdiffstats
path: root/Objects/floatobject.c
diff options
context:
space:
mode:
authorRaymond Hettinger <python@rcn.com>2008-06-24 22:28:56 (GMT)
committerRaymond Hettinger <python@rcn.com>2008-06-24 22:28:56 (GMT)
commit5c960b8c6430684fd78290d087ce9aa1791672a4 (patch)
treeac556778f1975d09f5ed6c24487f19713e97ce73 /Objects/floatobject.c
parent11c1a3326f41e1eb2a1865a554bbd9b12819fddd (diff)
downloadcpython-5c960b8c6430684fd78290d087ce9aa1791672a4.zip
cpython-5c960b8c6430684fd78290d087ce9aa1791672a4.tar.gz
cpython-5c960b8c6430684fd78290d087ce9aa1791672a4.tar.bz2
Revert 64451.
Diffstat (limited to 'Objects/floatobject.c')
-rw-r--r--Objects/floatobject.c30
1 files changed, 0 insertions, 30 deletions
diff --git a/Objects/floatobject.c b/Objects/floatobject.c
index 2465fa9..db1c99f 100644
--- a/Objects/floatobject.c
+++ b/Objects/floatobject.c
@@ -1113,36 +1113,6 @@ PyDoc_STRVAR(float_as_integer_ratio_doc,
">>> (-.25).as_integer_ratio()\n"
"(-1, 4)");
-PyObject *
-_float_to_base(PyObject *v, int base)
-{
- PyObject *mant, *conv, *result;
- double x, fr;
- int i, exp;
-
- if (!PyFloat_Check(v)) {
- PyErr_BadInternalCall();
- return NULL;
- }
- CONVERT_TO_DOUBLE(v, x);
- if (!Py_IS_FINITE(x))
- return PyObject_Repr(v);
- fr = frexp(x, &exp);
- for (i=0; i<300 && fr != floor(fr) ; i++) {
- fr *= 2.0;
- exp--;
- }
- mant = PyLong_FromDouble(floor(fr));
- if (mant == NULL)
- return NULL;
- conv = PyNumber_ToBase(mant, base);
- Py_DECREF(mant);
- if (conv == NULL)
- return NULL;
- result = PyUnicode_FromFormat("%U * 2.0 ** %d", conv, exp);
- Py_DECREF(conv);
- return result;
-}
static PyObject *
float_subtype_new(PyTypeObject *type, PyObject *args, PyObject *kwds);