Look at the three lines of code below.
float f = 1; float g = 1.1; float h = 1.1f;
Second line has compilation errors, while the ot
First line automatically casts int to float (ok).
int
float
Second line could not cast double to float because of loss of precision. You can make an explicit cast:
double
float g = (float) 1.1;
Third line does not need modification.