Hi,
I try to read a float in a string using sscanf or atof. It seems to work but then it's a bit strange when I manipulate the value obtained.
These lines return : 1429.000000
It seems to be due to the precision of the float type (Isn't it?).
Do you know how I can avoid that?
Regards
I try to read a float in a string using sscanf or atof. It seems to work but then it's a bit strange when I manipulate the value obtained.
Code:
float fl;
char str[]="1.43"
fl=atof(str);
printf("%f\n",floor(1000.0*fl) );
It seems to be due to the precision of the float type (Isn't it?).
Do you know how I can avoid that?
Regards
Comment