mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 15:28:11 +00:00
LibC: Fix strtod() parsing of negative exponents (#1645)
Before this fix negative exponents were interpreted as positive.
This commit is contained in:
parent
0403845d3e
commit
b82a2239c6
1 changed files with 3 additions and 1 deletions
|
@ -335,7 +335,9 @@ double strtod(const char* str, char** endptr)
|
|||
}
|
||||
|
||||
if (str[i] == 'e' || str[i] == 'E') {
|
||||
if (str[i + 1] == '-' || str[i + 1] == '+')
|
||||
if (str[i + 1] == '-')
|
||||
exp_val = -atoi(str + i + 2);
|
||||
else if (str[i + 1] == '+')
|
||||
exp_val = atoi(str + i + 2);
|
||||
else
|
||||
exp_val = atoi(str + i + 1);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue