In article 
<127fc97e-c210-4df1-952c-f6383d44b...@o8g2000vbq.googlegroups.com>,
 christian schulze <xcr...@googlemail.com> wrote:

> Hey guys,
> 
> I just found out, how much Python fails on simple math. I checked a
> simple equation for a friend.
> 
> [code]
> >>> from math import e as e
> >>> from math import sqrt as sqrt
> >>> 2*e*sqrt(3) - 2*e == 2*e*(sqrt(3) - 1)
> False
> [/code]
> 
> So WTF? The equation is definitive equivalent. (See http://mathbin.net/59158)

An amusing aspect of this is that the equations posted at that
link are "definitive" wrong.

Anyway, I don't know why you're jumping to the conclusion that it's
Python that's wrong here. Could be the math you learned in school
is wrong. I mean you're assuming that

(*)       a(b+c) = ab + ac

but what makes you so certain (*) is correct? Have you tried it with
every possible value of a, b, and c? Or do you just blindly believe
everything your teacher told you or what?

Seems to me you've stumbled on a counterexample to (*). I'm
gonna have to take this up with the mathematicians...

> PS:
> 
> #1:
> >>> 2.0 * e * sqrt(3.0) - 2.0 * e
> 3.9798408154464964
> 
> #2:
> >>> 2.0 * e * (sqrt(3.0) -1.0)
> 3.979840815446496
> 
> I was wondering what exactly is failing here. The math module? Python,
> or the IEEE specifications?
> 
> --

-- 
David C. Ullrich
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to