Kludge around a bug that results from printf() assuming that
dtoa() is buggy. The bug would cause incorrect output to be generated when format strings such as '%5.0f' were used with nonzero numbers whose magnitude is less than 1. Reported by: df(1) by way of periodic(8) Reviewed by: mike
This commit is contained in:
parent
15a66d2798
commit
3ba6b6dd9d
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=112224
@ -1536,7 +1536,7 @@ cvt(double value, int ndigits, int flags, char *sign, int *decpt,
|
||||
/* print trailing zeros */
|
||||
bp = digits + ndigits;
|
||||
if (ch == 'f') {
|
||||
if (*digits == '0' && value)
|
||||
if ((*digits == '0' || *digits == '\0') && value)
|
||||
*decpt = -ndigits + 1;
|
||||
bp += *decpt;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user