oleaut32: Remove one more use of sprintfW to format a double
Alex Villacís Lasso
a_villacis at palosanto.com
Wed Dec 20 12:53:41 CST 2006
This is another patch that removes one instance of sprintfW() usage to
format a double (flagged as broken by Alexandre Julliard - it ties
oleaut32 to LC_NUMERIC="C"). In addition to removing one case in which
number formatting can go wrong because of the user locale, this patch
also fixes the following potential problems in the current implementation:
- A CY has 64 bits of precision, but a double has only 52 bits (the rest
are for exponent and sign). A conversion from CY to double therefore can
cause loss of significant digits. This is specially important as CY is
supposed to be used in financial calculations. A decimal has 96 bits of
precision, more than enough for the conversion.
- A CY has an implicit multiplier of 10000, which is a power of 10.
However, the exponent in a double is 2-based. This can cause further
distortion of the value in conversion. A DECIMAL has a scale defined in
powers of 10, so this eliminates distortion caused by exponent base
change (A CY can be considered as a special case of a DECIMAL in which
the high 32 bits are 0 and the scale is fixed at 4).
Changelog:
* VarBstrFromCy() - Remove use of sprintfW by converting a CY into a
DECIMAL instead of a double as an intermediate step.
--
The following cryptic message was allegedly found in the inner edge of a Windows
XP installation CD:
4F6E65204F5320746F2072756C65207468656D20616C6C2C204F6E65204F5320746F2066696E6420
7468656D2C0D0A4F6E65204F5320746F206272696E67207468656D20616C6C20616E6420696E2074
6865206461726B6E6573732062696E64207468656D2E0A
It is rumored that only a true Unix Wizard can decypher this mysterious message,
which supposedly encodes the true nature and purpose of the software.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: wine-oleaut32-variant-VarBstrFromCy_remove_sprintfW.patch
Type: text/x-patch
Size: 938 bytes
Desc: not available
Url : http://www.winehq.org/pipermail/wine-patches/attachments/20061220/26842069/wine-oleaut32-variant-VarBstrFromCy_remove_sprintfW.bin
More information about the wine-patches
mailing list