On Fri, Jun 24, 2011 at 4:46 PM, Steven D'Aprano <steve+comp.lang.pyt...@pearwood.info> wrote: > Really? It works for me. > >>>> import decimal >>>> D = decimal.Decimal >>>> decimal.getcontext().prec = 2 >>>> >>>> D('32.01') + D('5.325') + D('12') > Decimal('49')
I'm curious. Is there a way to get the number of significant digits for a particular Decimal instance? I spent a few minutes browsing through the docs, and didn't see anything obvious. I was thinking about setting the precision dynamically within a function, based on the significance of the inputs. -- Jerry -- http://mail.python.org/mailman/listinfo/python-list