I am never going to complain about Python again

Oscar Benjamin oscar.j.benjamin at gmail.com
Thu Oct 10 15:47:18 EDT 2013


On 10 October 2013 18:48, Neil Cerutti <neilc at norwich.edu> wrote:
> I guess the "if appropriate" part eluded my eye. When *is* it
> appropriate? Apparently not during an equal test.
>
>>>> 5.0 == abs(3 + 4j)
> False

If the above is genuine output then it's most likely floating point
error. I wouldn't expect any errors in that though. What version of
Python are you using and on what OS/hardware?

I get the following in Python 2.7 and 3.2 on Ubuntu 12.04 with a
32-bit AMD processor:
>>> 5.0 == abs(3+4j)
True


Oscar



More information about the Python-list mailing list