workaround bug in printf for floats until we fix nprintf

This commit is contained in:
K. Lange 2018-09-22 17:34:48 +09:00
parent 78dc4381e1
commit a7fab6fbe8

View File

@ -237,7 +237,7 @@ int xvasprintf(char * buf, const char * fmt, va_list args) {
i = b - buf;
*b++ = '.';
buf++;
for (int j = 0; j < (precision > -1 ? precision : 8); ++j) {
for (int j = 0; j < ((precision > -1 && precision < 8) ? precision : 8); ++j) {
if ((int)(val * 100000.0) % 100000 == 0 && j != 0) break;
val *= 10.0;
print_dec((int)(val) % 10, 0, buf, &i, 0, 0);