diff --git a/eval.c b/eval.c index 429fee63..61d2a2b7 100644 --- a/eval.c +++ b/eval.c @@ -1543,16 +1543,16 @@ sexp sexp_vm (sexp ctx, sexp proc) { case OP_NULLP: _ARG1 = sexp_make_boolean(sexp_nullp(_ARG1)); break; case OP_INTEGERP: - _ARG1 = sexp_make_boolean(sexp_integerp(_ARG1) + j = sexp_integerp(_ARG1); #if USE_BIGNUMS - || sexp_bignump(_ARG1) + if (! j) j = sexp_bignump(_ARG1); #endif #if USE_FLONUMS - || (sexp_flonump(_ARG1) - && (sexp_flonum_value(_ARG1) - == trunc(sexp_flonum_value(_ARG1)))) + if (! j) + j = (sexp_flonump(_ARG1) + && (sexp_flonum_value(_ARG1) == trunc(sexp_flonum_value(_ARG1)))); #endif - ); + _ARG1 = sexp_make_boolean(j); break; case OP_SYMBOLP: _ARG1 = sexp_make_boolean(sexp_symbolp(_ARG1)); break; diff --git a/mkfile b/mkfile index 3caba3f9..1c6fb068 100644 --- a/mkfile +++ b/mkfile @@ -34,3 +34,6 @@ clean:V: install:V: $BIN/$TARG mkdir -p $MODDIR cp init.scm $MODDIR/ + +test:V: + ./chibi-scheme tests/r5rs-tests.scm diff --git a/opt/bignum.c b/opt/bignum.c index da5bbcbd..35cfec49 100644 --- a/opt/bignum.c +++ b/opt/bignum.c @@ -186,6 +186,10 @@ sexp sexp_read_bignum (sexp ctx, sexp in, sexp_uint_t init, return sexp_bignum_normalize(res); } +#ifdef PLAN9 +#define log2(n) (log(n)/log(2)) +#endif + sexp sexp_write_bignum (sexp ctx, sexp a, sexp out, sexp_uint_t base) { int i, str_len, lg_base = trunc(log2(base)); char *data;