Answer of the following code should be OK, I guess? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 4
14th May 2019, 7:21 PM
Aman Porwal
3 Answers
+ 6
Everything's down to precision. A double type number is more precise than a float type number. So, a float and a double can't be same because the precision of both are different (both have different interpretations for the same decimal number).
15th May 2019, 10:34 PM
Kainatic [Mostly Inactive Now]
Kainatic [Mostly Inactive Now] - avatar
+ 3
Because the variable "a" defined as a floating-point number stores the number 0.100000001
14th May 2019, 7:59 PM
Solo
Solo - avatar
+ 2
That's because 0.1 must be clearly defined as a float. So 0.1f
14th May 2019, 7:37 PM
Théophile
Théophile - avatar