fix parsing of negative numbers
This commit is contained in:
parent
c8c5795a48
commit
7a65de22bb
5
main.c
5
main.c
@ -68,8 +68,9 @@ void tokenize(char *expr) {
|
|||||||
if (IS_FLOAT(c) ||
|
if (IS_FLOAT(c) ||
|
||||||
(can_be_neg_num && c == '-' && IS_FLOAT(curr[1]))) {
|
(can_be_neg_num && c == '-' && IS_FLOAT(curr[1]))) {
|
||||||
char buf[16];
|
char buf[16];
|
||||||
size_t i = 0;
|
buf[0] = c;
|
||||||
while (IS_FLOAT(curr[i]) && i < 15) {
|
size_t i = 1;
|
||||||
|
while (i < 15 && IS_FLOAT(curr[i])) {
|
||||||
buf[i] = curr[i];
|
buf[i] = curr[i];
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user