This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author tim.peters
Recipients mark.dickinson, martin.panter, ned.deily, rhettinger, serhiy.storchaka, steven.daprano, tim.peters, vstinner
Date 2016-08-28.15:42:34
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1472398954.58.0.0945750122141.issue27761@psf.upfronthosting.co.za>
In-reply-to
Content
Victor, happy to add comments, but only if there's sufficient interest in actually using this.  In the context of this issue report, it's really only important that Mark understands it, and he already does ;-)

For example, it starts with float `**` because that's by far the fastest way to get a very good approximation.  Then it switches to Decimal to perform a Newton step using greater-than-float precision, which is necessary to absorb rounding errors in intermediate steps.  Then it rounds back to float, because it has to - it's a "float in, float out" function.  It's for the same reason, e.g., that Mark's `nroot` converts floats to potentially gigantic integers for its Newton step(s), and my other `fractions.Fraction` function converts floats to potentially gigantic rationals.  "Potentially gigantic" may be necessary to guarantee always-correct rounding of the final result, but isn't necessary to guarantee < 1 ulp error in the final result.
History
Date User Action Args
2016-08-28 15:42:34tim.peterssetrecipients: + tim.peters, rhettinger, mark.dickinson, vstinner, ned.deily, steven.daprano, martin.panter, serhiy.storchaka
2016-08-28 15:42:34tim.peterssetmessageid: <1472398954.58.0.0945750122141.issue27761@psf.upfronthosting.co.za>
2016-08-28 15:42:34tim.peterslinkissue27761 messages
2016-08-28 15:42:34tim.peterscreate