The fractional part of your numbers, 0.9, cannot be accurately represented by a floating point. Some rounding will occur, and probably the reason for the failure.
0.9 = (1/2) + (1/4) + (1/8) + (1/64) + (1/128) + (1/1024) + (1/2048) + (1/16384 ) + (1/32768) + (1/262144), etc. Etc. = 0.8999978005, etc.
Fractions that look around the human eye may not be round in the binary system.
0.5 is a round number for cpu = (1/2).
0.75 is round for cpu = (1/2) + (1/4).
Even 0.9072265625 is round ((1/2) + (1/4) + (1/8) + (1/32) + (1/1024))
But not 0.9 or 0.1. Not even 0.2 :)
EDIT: And of course, use epsilon to compare floats.
source share