Hi:
Env: Sun Sparc.
In trying to convert a string to a floating number, I don't always
get the exact value.
For example:
float value;
char str[10]; /* Say, str = "+0.02" */
sscanf(str, "%g", &value);
OR
sscanf(str, "%f", &value);
value is 0.0199999995529651642
Is there a strtof() function that can convert a string to a float?
If not, is there another way I can convert a string %f or %g to a
float without these rounding errors?
I am sure there is a way around this that I am not aware of.
Please help !!!
Respond by email to the address below.
Thank you.
---
Rupen Sheth
---------------------------------------------------------------------------
2550 Beckleymeade Ave. MS 4004 Phone: (214) 708-3344
Dallas, TX 75237 FAX: (214) 708-4827
---------------------------------------------------------------------------
--
Rupen Sheth
---------------------------------------------------------------------------
2550 Beckleymeade Ave. MS 4004 Phone: (214) 708-3344