Skip to content

Commit

Permalink
Update rtext.c (#3777)
Browse files Browse the repository at this point in the history
  • Loading branch information
raysan5 authored Feb 4, 2024
1 parent eed56a4 commit 00d1eb2
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/rtext.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 00d1eb2

Please sign in to comment.