Naveed Ahmed
Member level 4
float a=1.0;
char i;
for(i=0;i<100;i++)
{
a=a-0.01;
}
printf("%e\n",a);
In the above code, I expect the result of "a" to be 0, but why its not zero?? Can anyone tell me what is the reason for its error in precision?
Thnks,
Regards,
Naveed
char i;
for(i=0;i<100;i++)
{
a=a-0.01;
}
printf("%e\n",a);
In the above code, I expect the result of "a" to be 0, but why its not zero?? Can anyone tell me what is the reason for its error in precision?
Thnks,
Regards,
Naveed