Stefan Krah <stefan-use...@bytereef.org> added the comment:

I switched the algorithm in mpd_qsqrt() to the one from decimal.py.
Previously the square root was calculated in terms of 1/invsqrt(x).

Curiously enough this scheme _always_ seems to produce exact results
when expected, but I don't have a proof. I remember I left this in because the 
specification gives some leeway with respect to exact
results:


"Square-root can also be calculated by using the power operation (with a second 
operand of 0.5). The result in that case will not be exact in most cases, and 
may not be correctly rounded."


Anyway, the algorithm from decimal.py gives the desired guarantees
and is also faster.


Since we're almost in beta-2 stage, would someone be able to do a
post commit review of mpd_qsqrt()? It should be a direct translation
from the function in decimal.py.

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue7652>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to