offby1 error in bignum_to_double

also fixing exact? definition to include bignums
This commit is contained in:
Alex Shinn 2010-01-02 12:02:20 +09:00
parent 22968ec7b3
commit 227a094399
2 changed files with 2 additions and 2 deletions

View file

@ -425,7 +425,7 @@
(define complex? number?) (define complex? number?)
(define rational? number?) (define rational? number?)
(define real? number?) (define real? number?)
(define exact? fixnum?) (define (exact? x) (if (fixnum? x) #t (bignum? x)))
(define inexact? flonum?) (define inexact? flonum?)
(define (integer? x) (define (integer? x)
(if (fixnum? x) #t (if (bignum? x) #t (and (flonum? x) (= x (truncate x)))))) (if (fixnum? x) #t (if (bignum? x) #t (and (flonum? x) (= x (truncate x))))))

View file

@ -141,7 +141,7 @@ double sexp_bignum_to_double (sexp a) {
double res = 0; double res = 0;
sexp_sint_t i; sexp_sint_t i;
sexp_uint_t *data=sexp_bignum_data(a); sexp_uint_t *data=sexp_bignum_data(a);
for (i=sexp_bignum_hi(a); i>=0; i--) for (i=sexp_bignum_hi(a)-1; i>=0; i--)
res = res * ((double)SEXP_UINT_T_MAX+1) + data[i]; res = res * ((double)SEXP_UINT_T_MAX+1) + data[i];
return res; return res;
} }