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
Printable View
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
Yes I do.Quote:
Originally Posted by wakeup
If you want to know, please read these: How is floating point representated? and What are different number representations?
Laitinen
Yep. It has nothing to do with 'atof' but how floating point numbers are represented in a binary machine.
Viggy