Skip to content

Commit cc88e0b

Browse files
ListeriaMListeria monocytogenes
and
Listeria monocytogenes
authored
rtext: always multiply by sign in TextToFloat() (raysan5#4273)
Co-authored-by: Listeria monocytogenes <[email protected]>
1 parent c8bee7c commit cc88e0b

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

src/rtext.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1467,8 +1467,7 @@ float TextToFloat(const char *text)
14671467
int i = 0;
14681468
for (; ((text[i] >= '0') && (text[i] <= '9')); i++) value = value*10.0f + (float)(text[i] - '0');
14691469

1470-
if (text[i++] != '.') value *= sign;
1471-
else
1470+
if (text[i++] == '.')
14721471
{
14731472
float divisor = 10.0f;
14741473
for (; ((text[i] >= '0') && (text[i] <= '9')); i++)
@@ -1478,7 +1477,7 @@ float TextToFloat(const char *text)
14781477
}
14791478
}
14801479

1481-
return value;
1480+
return value*sign;
14821481
}
14831482

14841483
#if defined(SUPPORT_TEXT_MANIPULATION)

0 commit comments

Comments
 (0)