Mark Dickinson dicki...@gmail.com added the comment:
Applied in r77234 (trunk), r77237 (py3k).
--
resolution: - accepted
stage: patch review - committed/rejected
status: open - closed
versions: +Python 3.2 -Python 3.1
___
Python tracker
Mark Dickinson dicki...@gmail.com added the comment:
Long double (80 bits) exponent is in range [-16382; 16383] and so
would
fits in an int, unsigned int, size_t or Py_ssize_t.
Sure, but I don't think that's relevant to the point I was attempting to
make: PyLong_AsScaledDouble returns the
Mark Dickinson dicki...@gmail.com added the comment:
Here's a patch:
- rename _PyLong_AsScaledDouble to _PyLong_Frexp (for the benefit of
anyone foolish enough to be using an undocumented private API
function)
- make the exponent type Py_ssize_t instead of int
- do the scaling by
STINNER Victor victor.stin...@haypocalc.com added the comment:
Long double (80 bits) exponent is in range [-16382; 16383] and so would
fits in an int, unsigned int, size_t or Py_ssize_t. I don't know if a
signed or unsigned number is better. I know only one operation on
exponents: a-b in
Mark Dickinson dicki...@gmail.com added the comment:
Thanks for this. I'll take a look.
How about making the exponent type size_t or Py_ssize_t, rather than
[unsigned] int? It seems to me that that fits better with the usual size
in digits.
--
Changes by Mark Dickinson dicki...@gmail.com:
--
assignee: - marketdickinson
priority: - normal
stage: - patch review
type: - feature request
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue5576
New submission from STINNER Victor victor.stin...@haypocalc.com:
_PyLong_AsScaledDouble() writes the exponent in a int which have to be
multiplied by PyLong_SHIFT to give the power of 2. I proposed to
multiply the exponent by PyLong_SHIFT in _PyLong_AsScaledDouble() to
directly get the power
Changes by STINNER Victor victor.stin...@haypocalc.com:
--
nosy: +marketdickinson
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue5576
___
___