Regarding the -1: The issue with floating point numbers and equality comparison is a myth. You can and most likely will get into precision/rounding issues, if you are using the result of calculations or numeric literals that can not be represented exactly by the floating number types involved. In all other cases using == is perfectly safe.