mirror of
https://github.com/ashinn/chibi-scheme.git
synced 2025-05-21 14:49:18 +02:00
offby1 error in bignum_to_double
also fixing exact? definition to include bignums
This commit is contained in:
parent
22968ec7b3
commit
227a094399
2 changed files with 2 additions and 2 deletions
|
@ -425,7 +425,7 @@
|
|||
(define complex? number?)
|
||||
(define rational? number?)
|
||||
(define real? number?)
|
||||
(define exact? fixnum?)
|
||||
(define (exact? x) (if (fixnum? x) #t (bignum? x)))
|
||||
(define inexact? flonum?)
|
||||
(define (integer? x)
|
||||
(if (fixnum? x) #t (if (bignum? x) #t (and (flonum? x) (= x (truncate x))))))
|
||||
|
|
|
@ -141,7 +141,7 @@ double sexp_bignum_to_double (sexp a) {
|
|||
double res = 0;
|
||||
sexp_sint_t i;
|
||||
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];
|
||||
return res;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue