mirror of
https://github.com/libsdl-org/SDL.git
synced 2025-09-07 20:08:13 +00:00
Fixed rounding up in SDL_PrintFloat
This wasn't caught by the 9.9999999 case, because that value is actually just equal to 10.0
This commit is contained in:
@@ -1758,16 +1758,17 @@ static size_t SDL_PrintFloat(char *text, size_t maxlen, SDL_FormatInfo *info, do
|
||||
}
|
||||
if (num[i] == '9') {
|
||||
num[i] = '0';
|
||||
if (i == 0 || num[i - 1] == '-' || num[i - 1] == '+') {
|
||||
SDL_memmove(&num[i+1], &num[i], length - i);
|
||||
num[i] = '1';
|
||||
++length;
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
++num[i];
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (i == 0 || num[i] == '-' || num[i] == '+') {
|
||||
SDL_memmove(&num[i+1], &num[i], length - i);
|
||||
num[i] = '1';
|
||||
++length;
|
||||
}
|
||||
SDL_assert(length < sizeof(num));
|
||||
num[length++] = '0';
|
||||
} else {
|
||||
|
Reference in New Issue
Block a user