Commit 04de6fe3 authored by Piotr Caban's avatar Piotr Caban Committed by Alexandre Julliard

ucrtbase: Fix away from 0 rounding in %a format.

parent e475d045
......@@ -446,10 +446,10 @@ static inline int FUNC_NAME(pf_output_hex_fp)(FUNC_NAME(puts_clbk) pf_puts, void
mant >>= 4;
}
if(!flags->Precision) {
if(p[0] > '8') p[-2]++;
if(p[0] >= '8') p[-2]++;
if(!flags->Alternate) p--;
}else if(flags->Precision>0 && flags->Precision<MANT_BITS/4) {
BOOL round_up = (p[flags->Precision] > '8');
BOOL round_up = (p[flags->Precision] >= '8');
for(r=flags->Precision-1; r>=0 && round_up; r--) {
round_up = FALSE;
if(p[r]=='f' || p[r]=='F') {
......
......@@ -747,18 +747,21 @@ static void test_printf_fp(void)
{ "%.a", 0.1e-20, { "0x1p-70" }},
{ "%a", 0.1e-20, { "0x1.2e3b40a0e9b4fp-70" }},
{ "%a", 4.9406564584124654e-324, { "0x0.0000000000001p-1022" }},
{ "%.0a", -1.5, { "-0x1p+0" }},
{ "%.0a", -1.5, { "-0x2p+0" }, { "-0x1p+0" }},
{ "%.0a", -0.5, { "-0x1p-1" }},
{ "%.0a", 0.5, { "0x1p-1" }},
{ "%.0a", 1.5, { "0x1p+0" }},
{ "%.0a", 1.5, { "0x2p+0" }, { "0x1p+0" }},
{ "%.0a", 1.99, { "0x2p+0" }},
{ "%.0a", 2, { "0x1p+1" }},
{ "%.0a", 9.5, { "0x1p+3" }},
{ "%.0a", 10.5, { "0x1p+3" }},
{ "%#.0a", -1.5, { "-0x1.p+0" }},
{ "%#.0a", -1.5, { "-0x2.p+0" }, { "-0x1.p+0" }},
{ "%#.0a", -0.5, { "-0x1.p-1" }},
{ "%#.0a", 0.5, { "0x1.p-1" }},
{ "%#.0a", 1.5, { "0x1.p+0" }},
{ "%#.0a", 1.5, { "0x2.p+0" }, { "0x1.p+0" }},
{ "%#.1a", 1.03125, { "0x1.1p+0" }, { "0x1.0p+0" }},
{ "%#.1a", 1.09375, { "0x1.2p+0" }, { "0x1.1p+0" }},
{ "%#.1a", 1.15625, { "0x1.3p+0" }, { "0x1.2p+0" }},
{ "%f", 0, { "0.000000" }},
{ "%e", 0, { "0.000000e+00", NULL, "0.000000e+000" }},
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment