On Dec 23, 10:03 am, [email protected] wrote:
> (cc-ing the list)
Thanks. Looks like I'm still having trouble distinguishing between
'Reply' and 'Reply to author'. I'll have to work on my reading
abilities over the break...
> > > Is there a convenient way to force a decimal.Decimal representation to
> > not use exponential representation?
>
> > Which Python version are you using? For Python 2.6 (and 3.1), the
> > answer's yes. For earlier Python verions, I don't think so. In
> > Python 2.6, use new-style formatting with the 'f' modifier:
>
> > >>> '{0:f}'.format(Decimal('1e-100'))
> > '0.000000000000000000000000000000000000000000000000000000000000000000000000
> > 0000000000000000000000000001'
> > >>> '{0:f}'.format(Decimal('1e100'))
> > '10000000000000000000000000000000000000000000000000000000000000000000000000
> > 000000000000000000000000000'
>
> Unfortunately, I'm still using Python 2.4 so I can't go that way (at least
> not anytime soon, this is a production environment).
Hmm. The recipe you cite is probably the easiest option, then.
I can't help wondering what you're doing with numbers that small.
2.34e-19 looks an awful lot like 0 for many practical purposes...
--
Mark
--
http://mail.python.org/mailman/listinfo/python-list