I know that using ==
to check equality of floating-point variables is not a good way. But I just want to know that with the following statements:
In usual cases, it would evaluate to true. (or the assert statement won't do anything)
Edit:
By 'usual cases' I mean am excluding the aforementioned scenarios (such as NaN values and 80x87 floating point units) as pointed by other users.
Given the obsolesence of 8087 chips in today's context, the issue is rather isolated and for the question to be applicable in current state of floating-point architecture used, its true for all cases except for NaNs.
(reference about 8087 - https://home.deec.uc.pt/~jlobo/tc/artofasm/ch14/ch143.htm)
Kudos to @chtz for reproducing a good example and @kmdreko for mentioning NaNs - didn't knew about them before!