Float** internal representation (Numeric module)

Andrew Dalke adalke at mindspring.com
Wed Oct 22 05:14:35 EDT 2003


Alexander Sourjikov:
> i am using python for numerical simulations and noticed that
> when i assign a Float variable say 0.1 python sees it like
> 0.10000000149011612.

http://www.python.org/doc/faq/general.html#why-are-floating-point-calculatio
ns-so-inaccurate

It's a fact of life using computers.  If you're doing simulations,
you should learn more about numerical analysis, and make
sure you're using algorithms which are robust in the face of
expected error.  (Eg, molecular dynamics is chaotic but the
integrators are stable (I think the proper term is "symplectic")
and the results, while not exactly correct, still provide insight
into the problems.


                    Andrew
                    dalke at dalkescientific.com






More information about the Python-list mailing list