On Mon, 28 Mar 2005 12:03:24 -0500, Julian Hernandez Gomez <[EMAIL PROTECTED]> wrote: > is there a "easy way" to make eval() convert all floating numbers to Decimal > objects and return a Decimal? > eval('1.00000001+0.1111111') --> convert each number to a Decimal object, > perform the sum and obtain a Decimal object as a result? > maybe a parser is needed, but eval() already do the job, but I need the > precision that Decimal offers for numerical applications.
If you need the precision, why are you using strings instead of the numbers directly? Also, why not simply use Decimal('1.0000000') + Decimal('0.1111111') ? -- Swaroop C H Blog: http://www.swaroopch.info Book: http://www.byteofpython.info -- http://mail.python.org/mailman/listinfo/python-list