Skip to content

Commit

Permalink
Push NAN if a number has trailing chars
Browse files Browse the repository at this point in the history
  • Loading branch information
soveran committed Apr 20, 2017
1 parent 87b9156 commit 9255d2c
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion clac.c
Original file line number Diff line number Diff line change
Expand Up @@ -232,11 +232,13 @@ static void process(sds word) {
push(a);
} else if ((n = find(word)) != NULL) {
eval(n->meaning);
} else {
} else if (isdigit(word[0])) {
a = strtod(word, &z);

if (*z == '\0') {
push(a);
} else {
push(NAN);
}
}
}
Expand Down

0 comments on commit 9255d2c

Please sign in to comment.