summaryrefslogtreecommitdiffstats
path: root/Include
diff options
context:
space:
mode:
authorMark Dickinson <dickinsm@gmail.com>2010-01-02 15:33:56 (GMT)
committerMark Dickinson <dickinsm@gmail.com>2010-01-02 15:33:56 (GMT)
commit6ecd9e53ce43796a0626d16a89cd6a99b28333cc (patch)
tree006509589544384205fdb543e214b101e1c71414 /Include
parent01f748a8326770f98e514da85b4a42cae672cd80 (diff)
downloadcpython-6ecd9e53ce43796a0626d16a89cd6a99b28333cc.zip
cpython-6ecd9e53ce43796a0626d16a89cd6a99b28333cc.tar.gz
cpython-6ecd9e53ce43796a0626d16a89cd6a99b28333cc.tar.bz2
Merged revisions 77234 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk ........ r77234 | mark.dickinson | 2010-01-02 14:45:40 +0000 (Sat, 02 Jan 2010) | 7 lines Refactor some longobject internals: PyLong_AsDouble and _PyLong_AsScaledDouble (the latter renamed to _PyLong_Frexp) now use the same core code. The exponent produced by _PyLong_Frexp now has type Py_ssize_t instead of the previously used int, and no longer needs scaling by PyLong_SHIFT. This frees the math module from having to know anything about the PyLong implementation. This closes issue #5576. ........
Diffstat (limited to 'Include')
-rw-r--r--Include/longobject.h14
1 files changed, 7 insertions, 7 deletions
diff --git a/Include/longobject.h b/Include/longobject.h
index 28fb707..2bb1e71 100644
--- a/Include/longobject.h
+++ b/Include/longobject.h
@@ -44,13 +44,13 @@ PyAPI_FUNC(PyObject *) PyLong_GetInfo(void);
/* For use by intobject.c only */
PyAPI_DATA(unsigned char) _PyLong_DigitValue[256];
-/* _PyLong_AsScaledDouble returns a double x and an exponent e such that
- the true value is approximately equal to x * 2**(SHIFT*e). e is >= 0.
- x is 0.0 if and only if the input is 0 (in which case, e and x are both
- zeroes). Overflow is impossible. Note that the exponent returned must
- be multiplied by SHIFT! There may not be enough room in an int to store
- e*SHIFT directly. */
-PyAPI_FUNC(double) _PyLong_AsScaledDouble(PyObject *vv, int *e);
+/* _PyLong_Frexp returns a double x and an exponent e such that the
+ true value is approximately equal to x * 2**e. e is >= 0. x is
+ 0.0 if and only if the input is 0 (in which case, e and x are both
+ zeroes); otherwise, 0.5 <= abs(x) < 1.0. On overflow, which is
+ possible if the number of bits doesn't fit into a Py_ssize_t, sets
+ OverflowError and returns -1.0 for x, 0 for e. */
+PyAPI_FUNC(double) _PyLong_Frexp(PyLongObject *a, Py_ssize_t *e);
PyAPI_FUNC(double) PyLong_AsDouble(PyObject *);
PyAPI_FUNC(PyObject *) PyLong_FromVoidPtr(void *);