fix parsing of negative numbers

This commit is contained in:
r4 2021-11-17 11:47:51 +01:00
parent c8c5795a48
commit 7a65de22bb
1 changed files with 3 additions and 2 deletions

5
main.c
View File

@ -68,8 +68,9 @@ void tokenize(char *expr) {
if (IS_FLOAT(c) ||
(can_be_neg_num && c == '-' && IS_FLOAT(curr[1]))) {
char buf[16];
size_t i = 0;
while (IS_FLOAT(curr[i]) && i < 15) {
buf[0] = c;
size_t i = 1;
while (i < 15 && IS_FLOAT(curr[i])) {
buf[i] = curr[i];
i++;
}