Python fails on math

Tim Wintle tim.wintle at
Tue Feb 22 14:37:05 CET 2011

On Tue, 2011-02-22 at 05:20 -0800, christian schulze wrote:
> [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]

> I was wondering what exactly is failing here. The math module? Python,
> or the IEEE specifications?

I'm not sure anything is failing as such - the "A==B" operator checks if
values computed by the expressions A and B are equivalent - it doesn't
check if the expressions are equivalent (which you'd obviously need
algebra software to attempt).

(from the rest of your email I'm assuming you know what's actually

Tim Wintle

More information about the Python-list mailing list