Problems retreiving double from database
Troels Therkelsen
t_therkelsen at hotmail.com
Fri Jun 20 18:32:13 EDT 2003
In article <d2ef95ea.0306201417.77b78db7 at posting.google.com>, Thunder Perfect Mind wrote:
> I'm using an Access database where some fields are doubles. I'm using
> ADO to access this and when I try to retrieve the value in the field
> it returns the wrong value, instead of say 12.432 which might be the
> value of the field it returns 12.43200000000000003. Thinking this
> might be a problem with ADO I tried to use ODBC with the same
> result..... hmmmm maybe the database is the problem so I downloaded
> MySQL and connected with ODBC.... again same problem.
>
> Anyone know what causes this? and if so how do I fix it?
>
> Any help appreciated,
>
> dr//\//\
The problem isn't directly related to Python, but how floating-point numbers
are represented using a limited number of bits. Please read this page:
http://www.python.org/doc/current/tut/node14.html
Regards,
Troels Therkelsen
More information about the Python-list
mailing list