Dict handling of floats

Grant Edwards grante at visi.com
Fri Apr 25 01:57:55 EDT 2003


In article <98imn-ust.ln1 at grendel.myth>, Jim Richardson wrote:

> 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?

That's floats.  The best you can hope for is "almost right".  And that's
assuming your algorithm is right.  With the wrong algorithm you can easily
end up with "not at all right".

-- 
Grant Edwards                   grante             Yow!  I'm ANN LANDERS!! I
                                  at               can SHOPLIFT!!
                               visi.com            




More information about the Python-list mailing list