diff options
| author | Kai Stevenson <kai@kaistevenson.com> | 2023-02-17 22:54:34 -0800 |
|---|---|---|
| committer | Kai Stevenson <kai@kaistevenson.com> | 2023-02-17 22:54:34 -0800 |
| commit | bdc8e2a05f4d647deec81249546cc7582eefaf74 (patch) | |
| tree | cd5dbb19ad24744b9b92562da3d7026c7dd84094 /src/eval.c | |
| parent | 42696cdb053d994eacfc66bb348b0ddf0d80046c (diff) | |
fixed parsing negative numbers, added float functions
Diffstat (limited to 'src/eval.c')
| -rw-r--r-- | src/eval.c | 8 |
1 files changed, 6 insertions, 2 deletions
@@ -125,6 +125,7 @@ sym_t* try_eval_internal(sym_t* symbol, hashtable_t* symbolScope) { firstInt = symtoi(v); } else if (type == FLOAT) { + firstFloat = symtof(v); } else if (type == STRING) { firstString = symtos(v); @@ -140,9 +141,12 @@ sym_t* try_eval_internal(sym_t* symbol, hashtable_t* symbolScope) { return init_sym_int(0); } } - /* TODO: float */ else if (type == FLOAT) { - + float sf = symtof(v); + destroy_sym(v); + if (sf != firstFloat) { + return init_sym_int(0); + } } else if (type == STRING) { char* ss = symtos(v); |
