stdio fmt: fix %.0e by always rounding even if precision is 0

This commit is contained in:
Gavin Hayes 2022-08-17 13:49:39 -04:00
parent e5f705ace3
commit 625d42d52a

View file

@ -379,7 +379,7 @@ int __fmt_dtoa(int (*out)(const char *, void *, size_t), void *arg, int d,
if (prec < 0) prec = 0;
if (!longdouble) {
x = va_arg(va, double);
s = s0 = dtoa(x, prec ? 2 : 0, prec + 1, &decpt, &fpb.sign, &se);
s = s0 = dtoa(x, 2, prec + 1, &decpt, &fpb.sign, &se);
if (decpt == 9999) {
if (s && s[0] == 'N') {
fpb.kind = STRTOG_NaN;