printing float

val = 5.0 / 2.0;
val = (float)5 / 2;

are more or less then same thing to the compiler. The second form tells the compiler to treat the value 5 as floating point. The compiler will always promote any other variables in an expression to a float if any one is a float. But because many Arduino users may not be aware of the promotion properties of the language, the former is easier for people to understand.