0
Help please. This question is confusing
float f1=0.1 If (f1==0.1) printf("Equal") else printf("unequal") Answer was "unequal"
1 Réponse
+ 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)
...