fixed float printing errors

This commit is contained in:
2023-01-20 00:24:55 +06:00
parent 8b5db6c23f
commit c5e1a42eb7
3 changed files with 18 additions and 8 deletions

View File

@@ -68,6 +68,9 @@ char* toString_uint(uint64 n, bool withPostfix, bool uppercase){
if(precision==0)\
precision=toString_float_default_precision;\
int cn=sprintf(str, "%.*f", precision, n);\
/* remove trailing zeroes except .0*/\
while(str[cn-1]=='0' && str[cn-2]!='.')\
cn--;\
if(withPostfix)\
str[cn++]= uppercase ? 'F' : 'f';\
str[cn]='\0';\