0 ≠ 0 ...can someone explain?

Welcome to the world of computers and floating point numbers. When working with floating point numbers you should not rely on equality, especially not bit-for-bit.

There are quite many posts about it on our discourse, but my all-time favourite is

and the reaction to it

See

for links to more information.

In the end, when working with floating point numbers you’ll have to literally take it all with a grain of salt (called epsilon).

3 Likes