Author skrah
Recipients Amaury.Forgeot.d'Arc, Arfrever, Jim.Jewett, Ramchandra Apte, amaury.forgeotdarc, asvetlov, benjamin.peterson, casevh, ced, eric.smith, eric.snow, jjconti, lemburg, mark.dickinson, pitrou, python-dev, rhettinger, skrah, vstinner
Date 2012-07-12.19:40:11
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1342122012.27.0.48067597802.issue7652@psf.upfronthosting.co.za>
In-reply-to
Content
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.
History
Date User Action Args
2012-07-12 19:40:12skrahsetrecipients: + skrah, lemburg, rhettinger, amaury.forgeotdarc, mark.dickinson, pitrou, vstinner, casevh, eric.smith, benjamin.peterson, jjconti, Arfrever, ced, asvetlov, Amaury.Forgeot.d'Arc, python-dev, eric.snow, Ramchandra Apte, Jim.Jewett
2012-07-12 19:40:12skrahsetmessageid: <1342122012.27.0.48067597802.issue7652@psf.upfronthosting.co.za>
2012-07-12 19:40:11skrahlinkissue7652 messages
2012-07-12 19:40:11skrahcreate