0
Why is 1.0 +5 Is 6.0 why not 6
3 Réponses
+ 9
Floats have more precision (not the same thing as accuracy), so the answer is converted to float.
+ 2
Because float has higher precedence(of high priority than int), so automatic conversion(implicit conversion) takes place and results in a floating point value.
+ 1
if you had 1.5+6 you'd want the answer to be 7.5 not 7.. so by default when you're adding a float to an integer, the output is a float