Python fails on math
Roy Smith
roy at panix.com
Tue Feb 22 18:59:23 CET 2011
In article <ik0rmr$ck4$1 at reader1.panix.com>,
Grant Edwards <invalid at invalid.invalid> wrote:
> Python doesn't do equations. Python does floating point operations.
More generally, all general-purpose programming languages have the same
problem. You'll see the same issues in Fortran, C, Java, Ruby, Pascal,
etc, etc. You'll see the same problem if you punch the numbers into a
hand calculator. It's just the nature of how digital computers do
floating point calculations.
If you really want something that understands that:
>>>> 2*e*sqrt(3) - 2*e == 2*e*(sqrt(3) - 1)
you need to be looking at specialized math packages like Mathematica and
things of that ilk.
More information about the Python-list
mailing list