From bdc8e2a05f4d647deec81249546cc7582eefaf74 Mon Sep 17 00:00:00 2001 From: Kai Stevenson Date: Fri, 17 Feb 2023 22:54:34 -0800 Subject: fixed parsing negative numbers, added float functions --- src/eval.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'src/eval.c') diff --git a/src/eval.c b/src/eval.c index 386442c..63305b4 100644 --- a/src/eval.c +++ b/src/eval.c @@ -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); -- cgit v1.3.1