Float is a single precision number. But double has double precision.
And it has difference in storage format.
float has 4 bytes but double has 8 bytes.
Try to differentiate with the printf itself.
Code:
printf("Double (0.7):%0.12f\n",0.7);
printf("Float (0.7):%0.6f\n",0.7);
printf("Double (0.8):%0.12f\n",0.8);
printf("Double (0.8):%0.6f\n",0.8);
And for me that I could see the difference in 0.17f that may be different in other OS. ( I am using Linux ).
And It takes the approximate number to check that values in the condition.
if you used constants while assigning the values it is good always, because it can solve many problems like this.
or you can use this constant while checking the condition.
Code:
if(0.7f > a )
printf("HELLO\n");
else
printf("BEllo\n");