[...]I don't know the precise answer. But it's not surprising at all to me
Why would the float variables get different values between the "Debug"
and
"Release" builds?
that there may be subtle differences in floating point behavior between
the two versions. Doing identity comparisons between floating point
values is almost never the right approach, and your experience
demonstrates why.
I think that your solution, converting to integers and then comparing
that, is a perfectly reasonable approach, especially given the problem
domain. You could also have compared the difference between two floating
point values and considered them equal as long as the difference was small
enough. That's a fairly common approach in other scenarios using floating
point, but in this case it's probably overkill.
Pete