What's the difference between multiply by 5 and 5f? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
18th Feb 2020, 8:10 AM
Adi Pratama
Adi Pratama - avatar
3 Answers
+ 1
Positions tend to use floats and doubles, since you need precision. Using a float is the way to go, in that particular case.
18th Feb 2020, 10:04 AM
Fernando Pozzetti
Fernando Pozzetti - avatar
+ 1
If you multiply by 5 you get an integer for example: 5 * 2 = 10 If you multiply with 5f(float) the result is for example 5f * 2 = 10 or 5.0f * 2 = 10 ..
18th Feb 2020, 10:43 PM
Kevin Krüger
Kevin Krüger - avatar
+ 1
f for float
19th Feb 2020, 6:53 PM
suvam kumar sahoo
suvam kumar sahoo - avatar