Fix of string.format("%.0f") (#3199)

Co-authored-by: vsky <blue205@centrum.cz>
This commit is contained in:
Lukáš Voborský 2020-07-07 15:35:37 +02:00 committed by GitHub
parent 95f5191cd3
commit 2fa63a1303
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 3 deletions

View File

@ -642,6 +642,9 @@ vsprintf (char *d, const char *s, va_list ap)
//static void dtoa (char *, double, int, int, int);
void dtoa (char *dbuf, rtype arg, int fmtch, int width, int prec);
dbl = va_arg(ap, double);
if (!haddot) {
trunc = 6;
}
dtoa(d, dbl, *s, width, trunc);
trunc = 0;
}
@ -763,9 +766,7 @@ void dtoa (char *dbuf, rtype arg, int fmtch, int width, int prec)
return;
}
if (prec == 0)
prec = 6;
else if (prec > MAX_FRACT)
if (prec > MAX_FRACT)
prec = MAX_FRACT;
/* leave room for sign at start of buffer */