#include <stdio.h>
#include <stdlib.h>
int main(void)
{
float j = 1.0f, i =j;
int n = 0;
for(; i - j - 1.00f; ++n, j /= 10)
{
;
}
printf("%d", n);
return EXIT_SUCCESS;
}
I supposed the output was 6, because the float's precision is 6, but
as the result, the output is 20.
why?
#include <stdlib.h>
int main(void)
{
float j = 1.0f, i =j;
int n = 0;
for(; i - j - 1.00f; ++n, j /= 10)
{
;
}
printf("%d", n);
return EXIT_SUCCESS;
}
I supposed the output was 6, because the float's precision is 6, but
as the result, the output is 20.
why?
Comment