http://bugs.winehq.org/show_bug.cgi?id=28422
--- Comment #6 from Alan W. Irwin irwin@beluga.phys.uvic.ca 2012-11-02 18:00:51 CDT --- Piotr Caban said:
This bug should be fixed, please retest.
This fix is not quite right since it still loses precision compared to the equivalent Linux library.
The following simple test programme demonstrates the issue:
#include <stdlib.h> #include <stdio.h>
int main(void) { long double x; char buffer[1000]; while(fscanf(stdin, "%s", buffer) >= 1) { printf("%s is input string\n", buffer); if (sscanf(buffer, "%Le", &x) != 1) exit(1); printf("%30.22Le is output string\n", x); } return 0; }
For the git clone of the master Wine repo (which now has your fix) the result is:
bash.exe-3.1$ echo 0.1 |./a.exe 0.1 is input string 1.0000000000000000555112e-001 is output string
The corresponding Linux result is
wine@raven> echo 0.1 |./a.out 0.1 is input string 1.0000000000000000000136e-01 is output string
The git Wine result has a relative difference of 6.e-17 between input and output and the Linux result has relative difference of 1.e-20 between input and output which implies 3-4 decimal digits of long double precision are lost with the git Wine version.
I also have a much more extensive (but less easy to interpret) case involving doubles (as opposed to long doubles) that indicates the git-Wine scanf version is not quite as numerically precise as the Linux version.
From these results I wonder if your fix has some double (as opposed to long
double) arithmetic in it for both the double and long double conversions. Over the weekend I will look harder at that possibility, but I hope you do as well.