|
|
|
@ -655,6 +655,8 @@ static void fmtfp(char *buffer, size_t *currlen, size_t maxlen, |
|
|
|
|
int zpadlen = 0; |
|
|
|
|
int caps = 0; |
|
|
|
|
int index; |
|
|
|
|
int fzeropad = 0; |
|
|
|
|
int fzerocnt = 0; |
|
|
|
|
double intpart; |
|
|
|
|
double fracpart; |
|
|
|
|
double temp; |
|
|
|
@ -728,6 +730,13 @@ static void fmtfp(char *buffer, size_t *currlen, size_t maxlen, |
|
|
|
|
|
|
|
|
|
/* Convert fractional part */ |
|
|
|
|
if (fracpart) { |
|
|
|
|
// leading zeros in the fractional part
|
|
|
|
|
fzeropad = 0; |
|
|
|
|
fzerocnt = max - 1; |
|
|
|
|
while (fracpart < POW10(fzerocnt)) { |
|
|
|
|
fzeropad++; |
|
|
|
|
fzerocnt--; |
|
|
|
|
} |
|
|
|
|
do { |
|
|
|
|
temp = fracpart; |
|
|
|
|
my_modf(fracpart * 0.1, &fracpart); |
|
|
|
@ -785,8 +794,19 @@ static void fmtfp(char *buffer, size_t *currlen, size_t maxlen, |
|
|
|
|
if (max > 0) { |
|
|
|
|
dopr_outch(buffer, currlen, maxlen, '.'); |
|
|
|
|
|
|
|
|
|
while (fplace > 0) |
|
|
|
|
if (zpadlen > fzeropad) { |
|
|
|
|
zpadlen -= fzeropad; |
|
|
|
|
} else { |
|
|
|
|
zpadlen = 0; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
while (fzeropad-- > 0) { |
|
|
|
|
dopr_outch(buffer, currlen, maxlen, '0'); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
while (fplace > 0) { |
|
|
|
|
dopr_outch(buffer, currlen, maxlen, fconvert[--fplace]); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
while (zpadlen > 0) { |
|
|
|
|