# HG changeset patch # User Matti Hamalainen # Date 1456222572 -7200 # Node ID 40ce4106f4ad9b526d4dffe5616f2cde10bd1bbe # Parent 0084618812ee4e0c42ca4be33343ecb2ee379c01 Add special case handling for f_prec == 0 && val == 0. Fixes several test cases. diff -r 0084618812ee -r 40ce4106f4ad th_printf1.c --- a/th_printf1.c Tue Feb 23 12:15:51 2016 +0200 +++ b/th_printf1.c Tue Feb 23 12:16:12 2016 +0200 @@ -39,6 +39,11 @@ // Render the value to a string in buf (reversed) TH_PFUNC_TYPE_U val = pval; #endif + + // Special case for value of 0 and precision 0 + if (val == 0 && f_prec == 0) + return 0; + do { TH_PFUNC_TYPE_U digit = val % radix;