Update rtext.c (#3777)

This commit is contained in:
Ray 2024-02-04 11:20:11 +01:00 committed by GitHub
parent eed56a45d6
commit 00d1eb2bd0
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -1471,13 +1471,14 @@ float TextToFloat(const char *text)
text++;
}
for (int i = 0; ((text[i] >= '0') && (text[i] <= '9')); i++) value = value*10.0f + (float)(text[i] - '0');
int i = 0;
for (; ((text[i] >= '0') && (text[i] <= '9')); i++) value = value*10.0f + (float)(text[i] - '0');
if (text[i++] != '.') value *= sign;
else
{
float divisor = 10.0f;
for (int i = 0; ((text[i] >= '0') && (text[i] <= '9')); i++)
for (; ((text[i] >= '0') && (text[i] <= '9')); i++)
{
value += ((float)(text[i] - '0'))/divisor;
divisor = divisor*10.0f;