On Mon, Nov 23, 2009 at 2:43 PM, Gregor Schneider grschneider@gmail.com wrote:
This patch proposes to calculate the fp digits in scanf with the internally used long double precision instead of simple float accuracy. With the current implementation small errors are added with each calculation step originating from the used float type. This becomes obvious when parsing to more precise fp types like double or long double and outputting a large number of digits from the created number. Example code like the following
double d; swscanf(L"3.1415", L"%lf", &d); wprintf(L"%3.12f\n", d);
produces an output of "3.141500000478", while "3.141500000000" would be the expected result with this precision. The attached patch fixes this problem.
Please add a testcase for this behavior, to prevent regressions.