Skip to content

Commit 3f4b174

Browse files
committed
fix sign handling in atof
fix #40
1 parent 27eb7ef commit 3f4b174

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

hardware/esp8266com/esp8266/cores/esp8266/core_esp8266_noniso.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ long atol(const char* s)
4949
double atof(const char* s)
5050
{
5151
double result = 0;
52-
double sign = 1;
52+
double factor = 1.0;
5353

5454
while (*s == ' ' || *s == '\t' || *s == '\r' || *s == '\n')
5555
++s;
@@ -59,7 +59,7 @@ double atof(const char* s)
5959

6060
if (*s == '-')
6161
{
62-
sign = -1;
62+
factor = -1.0;
6363
++s;
6464
}
6565
if (*s == '+')
@@ -68,7 +68,6 @@ double atof(const char* s)
6868
}
6969

7070
bool decimals = false;
71-
double factor = 1.0;
7271
char c;
7372
while((c = *s))
7473
{

0 commit comments

Comments
 (0)