On Tue, May 3, 2011 at 5:49 AM, Steven D'Aprano < steve+comp.lang.pyt...@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.
-- http://mail.python.org/mailman/listinfo/python-list