Decimal() instead of float?

Steven D'Aprano steve at REMOVE.THIS.cybersource.com.au
Sat Nov 11 21:08:32 EST 2006


On Sun, 12 Nov 2006 02:31:04 +0100, Fredrik Lundh wrote:

>> 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
> 
> sounds odd.  are you sure you don't mean "stored as strings containing 
> decimal numbers" ?
> 
> (who uses fractional ZIP codes, btw?)

Well, I can't speak for Americans, but here in Australia we typically give
our post codes to six decimal places:

Melbourne 3000.000000
Brunswick 3056.000000
Clifton Hill 3068.000000
Sydney 2000.000000
St Johns Park 2176.000000

and so forth. You can't have too much precision with those floating point
post/ZIP codes!


-- 
Steven.




More information about the Python-list mailing list