Recursion or iteration (was Fibonacci series recursion error)

Dan Stromberg drsalists at gmail.com
Tue May 3 12:10:52 EDT 2011


On Tue, May 3, 2011 at 5:49 AM, Steven D'Aprano <
steve+comp.lang.python at pearwood.info> wrote:

> On Tue, 03 May 2011 21:04:07 +1000, Chris Angelico wrote:
>
> > And that, Your Honour, is why I prefer bignums (especially for integers)
> > to floating point. Precision rather than performance.
>
> I'm intrigued by your comment "especially for integers", which implies
> that you might use bignums for non-integers. Out of curiosity, how would
> you calculate:
>
> sin(sqrt(7)*pi/31)
>
> using bignums?
>

It's a bit of a stretch, but you could wrap a fixed slash implementation
around bignums to do this.
http://portal.acm.org/citation.cfm?id=1309566

Fixed slash is like a rational, but you never let the numerator or
denominator grow huge, instead reducing the precision of the fraction now
and then to keep things manageable.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20110503/418a6060/attachment-0001.html>


More information about the Python-list mailing list