Dict handling of floats

Jim Richardson warlock at eskimo.com
Fri Apr 25 09:21:47 CEST 2003


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Thu, 24 Apr 2003 23:30:43 -0400,
 Tim Peters <tim_one at email.msn.com> wrote:
> [Jim Richardson]
>> I have come across a weirdness. I have a number of floats, (lat long
>> pairs) which I stuff into a dict, but when I take them out, my nice %2f4
>> number, (say, 47.5894) is something long and *almost* right, like
>> 47.589333333333333339. What gives? I am not doing anything special as
>> far as I can tell, just stuffing the numbers into a dict, and recalling
>> it later. This is with Python 2.2 on Linux, and no, it's not an original
>> Pentium :)
> 
>> ...
>> Linux, because eventually, you grow up enough to be trusted with a fork()
> 
> OTOH, I'm not sure anyone grows up enough to be trusted with a float <wink>:
> 
>     http://www.python.org/doc/current/tut/node14.html
> 
> 


I figured it was something like that, It doesn't make any difference in
my application, I just found it kind of odd.

I have no real schooling in programming, all I learn is as I go,
sometimes, stuff like this, trips me up. 

<Jim, who *still* doesn't grokk self.>

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.1 (GNU/Linux)

iD8DBQE+qOILd90bcYOAWPYRAtLvAJ90amgaw1KvVFr0MSsAJluZ0DJN5QCgpI7n
EYLMHLtMIdNY/vnHQ9nJLAQ=
=8fIH
-----END PGP SIGNATURE-----

-- 
Jim Richardson         http://www.eskimo.com/~warlock

Lintel, because you don't support heavy loads with windows.




More information about the Python-list mailing list