0

Help please. This question is confusing

float f1=0.1 If (f1==0.1) printf("Equal") else printf("unequal") Answer was "unequal"

9th Jul 2019, 6:54 PM
Prashant Kumar
Prashant Kumar - avatar
1 Respuesta
+ 3
Float precision numbers are stored differently than double precision numbers, therefore they won't be equal. They would be equal if: f1 was a double: double f1 = 0.1; if (f1 == 0.1) ... It was compared to a float: if (f1 == 0.1f) ...
9th Jul 2019, 6:58 PM
Airree
Airree - avatar