In addition to FAQ:
Please note that using function sccanf() to convert string into f with float type,
The result may not be what you want.Code:sscanf(str_float, "%f", &f);
refer to the example of FAQ:
You will find the out is: f is now = 333.299988Code:printf("f is now = %f\n", f);
The myth here is sccanf actually convert str_float into double type. if you cast it back to float, there will be some differences, because the way floating point is represented. See this FAQ for more.




Reply With Quote