msvcrt: Update round_limb on first limb length change in printf.

Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=51435
Signed-off-by: Piotr Caban <piotr@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
(cherry picked from commit 2ffcf44021)
Signed-off-by: Michael Stefaniuc <mstefani@winehq.org>
This commit is contained in:
Piotr Caban 2021-07-10 20:38:16 +02:00 committed by Michael Stefaniuc
parent 89926751ff
commit 2253901ccf
2 changed files with 15 additions and 0 deletions

View File

@ -704,11 +704,25 @@ static inline int FUNC_NAME(pf_output_fp)(FUNC_NAME(puts_clbk) pf_puts, void *pu
if(i != first_limb_len) {
first_limb_len = i;
radix_pos++;
round_pos++;
if (round_pos == LIMB_DIGITS)
{
round_pos = 0;
round_limb++;
}
}
} else if(i == b->e) {
first_limb_len = 1;
radix_pos++;
b->e++;
round_pos++;
if (round_pos == LIMB_DIGITS)
{
round_pos = 0;
round_limb++;
}
}
}
}

View File

@ -819,6 +819,7 @@ static void test_printf_fp(void)
{ "%.0f", 0.5, { "1", NULL, NULL, NULL, "0" }, {NULL, NULL, NULL, NULL, "1" }},
{ "%.0f", 1.5, { "2" }},
{ "%.0f", 2.5, { "3", NULL, NULL, NULL, "2" }, {NULL, NULL, NULL, NULL, "3" }},
{ "%g", 9.999999999999999e-5, { "0.0001" }},
};
const char *res = NULL;