In your first example, the suffix f only affects literals, not after the whole expression. So write this in one of these ways (assuming springing is a float []):
springing[n] = .05f*(.17f*(n+1)); springing[n] = (float)( .05*(.17*(n+1)));
The first one does the whole calculation (except for the part n+1 ) in float, the second one calculates in double, and then converts only the result to float.
(And in both cases, the bracket between .05 and .17 (and the corresponding one) is usually redundant, since multiplication is associative. This may have some meaning for really large n values, but in these cases you usually need another way to avoid overflow.)
source share