about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--src/stdio/vfprintf.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/stdio/vfprintf.c b/src/stdio/vfprintf.c
index 0be75498..f6e7f38d 100644
--- a/src/stdio/vfprintf.c
+++ b/src/stdio/vfprintf.c
@@ -308,8 +308,8 @@ static int fmt_fp(FILE *f, long double y, int w, int p, int fl, int t)
 			*d = x % 1000000000;
 			carry = x / 1000000000;
 		}
-		if (!z[-1] && z>a) z--;
 		if (carry) *--a = carry;
+		while (z>a && !z[-1]) z--;
 		e2-=sh;
 	}
 	while (e2<0) {