tisp

tiny lisp
git clone git://edryd.org/tisp
Log | Files | Refs | LICENSE

commit efdb67a929094626d7362fd109f5988ee37ba58c
parent 9ecbaa7ab7663d0a2b6fbb35f9de650b2727e65b
Author: Ed van Bruggen <edvb@uw.edu>
Date:   Sat, 28 Dec 2019 23:42:33 -0800

Have sgn preserve number type

Diffstat:
test.c | 2+-
tibs/lib.tsp | 2+-
2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/test.c b/test.c @@ -466,7 +466,7 @@ char *tests[][2] = { { "(sgn 3.17)", "1.0" }, { "(sgn -.457)", "-1.0" }, { "(sgn 0)", "0" }, - { "(sgn 0.0)", "0" }, + { "(sgn 0.0)", "0.0" }, { "max/min", NULL }, { "(max 9346 13297)", "13297" }, diff --git a/tibs/lib.tsp b/tibs/lib.tsp @@ -253,7 +253,7 @@ (f (cdr lst))))) (define (abs x) (if (>= x 0) x (- x))) -(define (sgn x) (if (= x 0) 0 (/ (abs x) x))) +(define (sgn x) (if (= x 0) x (/ (abs x) x))) ; TODO many args (define (max a b) (if (> a b) a b)) (define (min a b) (if (< a b) a b))