Hi...Have this doubt about floating points in C
Look at the two programs below.
1. main()
{ float a = 0.7;
if(a < 0.7)
printf("Less");
else
printf("More");
}
2. main()
{ float a = 0.7, b=0.7;
if(a < b)
printf("Less");
else
printf("More");
}
Now, the first program prints Less and the second one prints More. And in both the programs if the value of a is printed, we get 0.700000.
The same program behaves differently when we use the datatype double instead of float.
Can anyone tell me why?
--
pits