0

Plz tell me why this output?

https://code.sololearn.com/cCMJO1KbXZk2/?ref=app What is the output?

19th Mar 2019, 4:19 AM
VEERESH MAURYA
VEERESH MAURYA - avatar
1 Resposta
+ 2
Literals ("4.2") are of type double, not float. And when you convert 4.2 to a float, to store it in a, you lose some precision, and here it happened to change the absolute value. https://code.sololearn.com/cvr52qOXURyx/?ref=app
19th Mar 2019, 4:41 AM
Vlad Serbu
Vlad Serbu - avatar