Home > Back-end >  Why use atof conversion long string will go wrong?
Why use atof conversion long string will go wrong?

Time:10-09

RT, RT
Before the first line is transformation, why the string is too long will be wrong? No type double overflow??

CodePudding user response:

With sscanf is also the same effect

CodePudding user response:

Double: 52 ^ 2=4503599627370496, a total of 16, in the same way, the precision of the double for 15 to 16,

CodePudding user response:

Should or overflow,

CodePudding user response:

Floating point Numbers significant figures float only 6 ~ 7, double only 15 ~ 16
The overflow is not express range of overflow is effective digital overflow

1/3 0.333333333 is infinite, a digital computer can only have a limited binary units, must be able to express the accurate, can only be approximate
  • Related