|
-
April 2nd, 2008, 04:12 AM
#1
atof is not exact
This is the code
char number[]="0.58";
double value = atof(number);
When I execute it value is 0.57999999999999996
Do you know why?
Thanks in advance
-
April 2nd, 2008, 04:20 AM
#2
Re: atof is not exact
 Originally Posted by wakeup
Do you know why?
Yes I do.
If you want to know, please read these: How is floating point representated? and What are different number representations?
Laitinen
-
April 2nd, 2008, 04:19 PM
#3
Re: atof is not exact
Yep. It has nothing to do with 'atof' but how floating point numbers are represented in a binary machine.
Viggy
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|