best way of dealing with currency?
Asun Friere
afriere at yahoo.co.uk
Tue Oct 16 22:38:19 EDT 2007
On Oct 17, 10:56 am, Mark Shroyer <usenet-m... at markshroyer.com> wrote:
> On 2007-10-16, Diez B. Roggisch <de... at nospam.web.de> wrote:
> > The module decimal. But in the end, you might not be able to recreate
> > the same values as excel, due to the unknown intricacies of excel.
>
> But it can be done! All it takes is a little dedication. Here's a
> function that the OP might find useful, for example:
>
> def excel_multiply(a, b):
> if a * b != 850 * 77.1:
> return a * b
> else:
> return 100000
>
> Best of luck,
> Mark
OK joke, but it's worth noting that python's decimal behaves in the
same way as Excel given this example:
>>> from decimal import Decimal
>>> 850*Decimal('77.1')
Decimal("65535.0")
>>>
More information about the Python-list
mailing list