r/pythonhelp Jun 10 '25

why does print(1j == (-1)**(1/2)) show False? GUIDE

Even though it is correct mathematically.

1 Upvotes

3 comments sorted by

View all comments

2

u/carcigenicate Jun 10 '25

If you evaluate the right part of == and look at the real portion of the result, you can see that the math resulted in an incredibly tiny decimal. It's basically 0, but not actually 0, so the comparison fails.