By default, the real numeric literal on the right side of the assignment operator is treated as double. Therefore, to initialize the variable float, use the suffix f or F, as in the following example:
float x = 3.5F;
If you do not use the suffix in the previous declaration, you will get a compilation error because you are trying to store a double value in the float variable.
see msdn for more details
source share