msvcrt: Use Dragon4 algorithm to fix inconsistent rounding behaviour for sprintf and add tests.

YongHao Hu christopherwuy at gmail.com
Thu Feb 26 22:07:20 CST 2015


Hi, Zhenbo.
I have fixed the patch and send a new one to wine-patch, thank you. : )
The new patch looks good for me now.
I switch to a new branch and use  git apply 
~/0012-msvcrt-Use-Dragon4-algorithm-to-fix-inconsistent-round.txt
to apply my patch and compile it successfully. You can have a try.
BTW, I had the author's consent to distribute his implementation using 
the following license, which I had added to files.
  >// Derived from code released under the ZLIB license
  >//  Copyright (c) 2014 Ryan Juckett
  >//  http://www.ryanjuckett.com/

On 2015年02月27日 09:32, Zhenbo Li wrote:
> Hi, YongHao,
> Quite a huge patch lol
>
> I tried your patch.
>
> $ patch -p1 <0012-msvcrt-Use-Dragon4-algorithm-to-fix-inconsistent-round.txt
> (Stripping trailing CRs from patch; use --binary to disable.)
> patching file dlls/msvcrt/dragon4.h
> (Stripping trailing CRs from patch; use --binary to disable.)
> patching file dlls/msvcrt/printf.h
> (Stripping trailing CRs from patch; use --binary to disable.)
> patching file dlls/msvcrt/tests/printf.c
> (Stripping trailing CRs from patch; use --binary to disable.)
> patching file dlls/msvcrt/wine_printfloat.h
>
> Is this critical?
>
> Also, your patch failed to compile on my computer.
>
> dragon4.h:10:0: error: unterminated #ifndef
>   #ifndef __WINE_STDIO_H
>
> Why is it necessary here?
>
> And then, wine_printfloat.h:26:15: error: unknown type name 'uint32_t'
> It seems that you're using C99 types? It is not allowed in wine code[1]
>
> Finally, you've created two files with ZLIB license. Is it better to move all
> the ZLIB license code to one file? I'm not sure about that. Could someone
> have a check to avoid legal problems?
>
>
> [1]: wiki.winehq.org/Developers-Hints
>
> 2015-02-26 23:13 GMT+08:00 YongHao Hu <christopherwuy at gmail.com>:
>> Fix bug https://bugs.winehq.org/show_bug.cgi?id=37913 .
>> The Dragon4 algorithm implementation is based on
>> http://www.ryanjuckett.com/programming/printing-floating-point-numbers/.
>>
>> ---
>>   dlls/msvcrt/dragon4.h         | 670
>> ++++++++++++++++++++++++++++++++++++++++++
>>   dlls/msvcrt/printf.h          |  43 +--
>>   dlls/msvcrt/tests/printf.c    |  83 +++++-
>>   dlls/msvcrt/wine_printfloat.h | 248 ++++++++++++++++
>>   4 files changed, 1026 insertions(+), 18 deletions(-)
>>   create mode 100644 dlls/msvcrt/dragon4.h
>>   create mode 100644 dlls/msvcrt/wine_printfloat.h
>>
>>
>>
>>
>>
>
>




More information about the wine-devel mailing list