cplusplus
.com
TUTORIALS
REFERENCE
ARTICLES
FORUM
C++
Tutorials
Reference
Articles
Forum
Forum
Beginners
Windows Programming
UNIX/Linux Programming
General C++ Programming
Lounge
Jobs
Forum
General C++ Programming
Why atof(1.8) returns 1.79999
Why atof(1.8) returns 1.79999
Jul 15, 2010 at 9:12am UTC
peter nn
(7)
char str[128];
double retVal = atof(str);
str value is "1.80 ; some_text". Why atof returns 1.79999?
Visual C++ 2008 Express, Windows 7/64
Best regards,
Peter
Jul 15, 2010 at 9:30am UTC
Bazzy
(6281)
You never get much precision with floating point arithmetic
Jul 15, 2010 at 1:04pm UTC
jsmith
(5804)
Obligatory link:
http://docs.sun.com/source/806-3568/ncg_goldberg.html
Topic archived. No new replies allowed.