aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefile5
-rw-r--r--src/builtins.c2
-rw-r--r--tests/math.lisp2
3 files changed, 5 insertions, 4 deletions
diff --git a/Makefile b/Makefile
index 47f92ce..06e4b38 100644
--- a/Makefile
+++ b/Makefile
@@ -2,7 +2,6 @@ mode ?= debug
cc = gcc
includes = -DWITHREADLINE -I3rdparty/algds/build/include/
-#includes = -I3rdparty/algds/build/include/
3rdlibs = 3rdparty/algds/build/lib/libalgds.a
ldflags = -lm -lreadline
@@ -10,8 +9,8 @@ ifeq ($(mode), debug)
cflags = $(includes) \
-g \
-fsanitize=address
-else ifeq ($(mode), debug)
- cflags = $(includes) -g -flto -O2
+else
+ cflags = $(includes) -flto -O2
endif
src = $(shell find src/ -name '*.c' -not -name 'main.c')
diff --git a/src/builtins.c b/src/builtins.c
index 9f605c1..f1c7d10 100644
--- a/src/builtins.c
+++ b/src/builtins.c
@@ -1220,7 +1220,7 @@ SExpRef builtin_div(Interp *interp, SExpRef args) {
if (args_len == 1) {
SExp num = *REF(CAR(args));
if (num.type == kIntegerSExp) {
- return new_integer(interp, 1.0/num.integer);
+ return new_real(interp, 1.0/num.integer);
}
return new_real(interp, 1.0/num.real);
}
diff --git a/tests/math.lisp b/tests/math.lisp
index cbd5298..4ecf876 100644
--- a/tests/math.lisp
+++ b/tests/math.lisp
@@ -9,6 +9,8 @@
(assert (= 1 (abs 1)))
(assert (= 1.1 (abs 1.1)))
+(~~ 0.2 (/ 5))
+
(~~ 3.141 pi)
(assert-error (~~ 3.2 pi))