[Bug 28422] scanf family of functions provides only 7 digits of precision for converting doubles and long doubles

wine-bugs at winehq.org wine-bugs at winehq.org
Sun Nov 4 10:38:28 CST 2012


http://bugs.winehq.org/show_bug.cgi?id=28422

--- Comment #12 from Alan W. Irwin <irwin at beluga.phys.uvic.ca> 2012-11-04 10:38:28 CST ---
A simple test case where 100 random floating point (double) numbers were
converted to ascii using sprintf (with a precision of 20 to have sufficient
guard digits in the ascii representation) and back to double using sscanf
demonstrated the scanf family precision issue for wine-git. Because of the
guard digits the original and derived doubles should be exactly the same.  This
was the result of the test on Linux and also wine-1.5.16 with my old patch. 
But for wine-git 9 of the 100 random doubles had the last-bit flipped in the
derived value.  Eyeballing the scanf.h code in wine-git showed the attached
one-line patch was necessary to keep the precision of the long double variable
cur at the long double level.  With this one-liner applied to wine-git the
simple test case no longer showed in bit flips.  Furthermore, I went back to my
original ephcom test involving transforms from doubles to ascii (with
sufficient guard digits) and then back to double.  This time I tried every
single ephemeris I had access to and in all cases (which amounted to 2GB's of
doubles) there were no bit flips at all!  So my conclusion is this one-line
patch solves the precision issues for  the scanf family of functions for
wine-git.  So Piotr, once this one-liner is accepted into wine-git, please
close this bug as fixed.

-- 
Configure bugmail: http://bugs.winehq.org/userprefs.cgi?tab=email
Do not reply to this email, post in Bugzilla using the
above URL to reply.
------- You are receiving this mail because: -------
You are watching all bug changes.



More information about the wine-bugs mailing list