From 625d42d52af820712eb36700dbf7e2fad8221da6 Mon Sep 17 00:00:00 2001 From: Gavin Hayes Date: Wed, 17 Aug 2022 13:49:39 -0400 Subject: [PATCH] stdio fmt: fix %.0e by always rounding even if precision is 0 --- libc/stdio/dtoa.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libc/stdio/dtoa.c b/libc/stdio/dtoa.c index f0c7ee86e..7e4ba24a0 100644 --- a/libc/stdio/dtoa.c +++ b/libc/stdio/dtoa.c @@ -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;