mirror of
https://github.com/ashinn/chibi-scheme.git
synced 2025-05-19 05:39:18 +02:00
commit
f9bd4f9c0e
2 changed files with 8 additions and 1 deletions
5
eval.c
5
eval.c
|
@ -1706,6 +1706,11 @@ sexp sexp_expt_op (sexp ctx, sexp self, sexp_sint_t n, sexp x, sexp e) {
|
||||||
res = sexp_make_flonum(ctx, pow(10.0, 1e100)); /* +inf.0 */
|
res = sexp_make_flonum(ctx, pow(10.0, 1e100)); /* +inf.0 */
|
||||||
} else if (sexp_bignump(x)) {
|
} else if (sexp_bignump(x)) {
|
||||||
res = sexp_bignum_expt(ctx, x, e);
|
res = sexp_bignum_expt(ctx, x, e);
|
||||||
|
} else if (sexp_fixnump(x)) {
|
||||||
|
sexp_gc_preserve1(ctx, tmp);
|
||||||
|
tmp = sexp_fixnum_to_bignum(ctx, x);
|
||||||
|
res = sexp_bignum_expt(ctx, tmp, e);
|
||||||
|
sexp_gc_release1(ctx);
|
||||||
} else {
|
} else {
|
||||||
#endif
|
#endif
|
||||||
if (sexp_fixnump(x))
|
if (sexp_fixnump(x))
|
||||||
|
|
|
@ -16,8 +16,10 @@
|
||||||
(define (run-tests)
|
(define (run-tests)
|
||||||
(test-begin "numbers")
|
(test-begin "numbers")
|
||||||
|
|
||||||
|
(test 0 (expt 0 1))
|
||||||
|
(test 1 (expt 3 0))
|
||||||
(test 3 (expt 3 1))
|
(test 3 (expt 3 1))
|
||||||
;(test 1/3 (expt 3 -1))
|
(test 1/3 (expt 3 -1))
|
||||||
(test 1/300000000000000000000 (expt 300000000000000000000 -1))
|
(test 1/300000000000000000000 (expt 300000000000000000000 -1))
|
||||||
|
|
||||||
(test '(536870912 536870913 536870911 -536870912 -536870911 -536870913)
|
(test '(536870912 536870913 536870911 -536870912 -536870911 -536870913)
|
||||||
|
|
Loading…
Add table
Reference in a new issue