I am searching around, and I don't see anything helpful, but I could (as always) be missing something... I tried (rather naïvely) to just do something like:
>>> import decimal
>>> float=Decimal
>>> x=1.1
>>> x
1.1000000000000001
>>>
But, that didn't work (obviously). It was a shot, anyway. Are there any ideas, or does anyone have a way around this? I would prefer to not have to convert incoming floating point numbers to strings and then convert them to Decimal() types every single time that I want to use them (which would be in *every* case). For example, I have a ZIP code database that can do some processing on its numbers, and the numbers are stored as floating point values (exactly) but Python doesn't get them right; so the Decimal() thing would be needed. *shrugs*
Thanks a bunch,
Mike
--
Demand Freedom! Use open and free protocols, standards, and software! |
-- http://mail.python.org/mailman/listinfo/python-list