diff --git a/scheme/ikarus.numerics.ss b/scheme/ikarus.numerics.ss index 7b70b46..4943e5a 100644 --- a/scheme/ikarus.numerics.ss +++ b/scheme/ikarus.numerics.ss @@ -257,27 +257,23 @@ (let ([b0 ($flonum-u8-ref x 0)]) (fx> b0 127))) - - - - - (define (inexact->exact x) + (define ($exact x who) + (import (ikarus system $compnums)) (cond [(flonum? x) (or ($flonum->exact x) - (die 'inexact->exact "no real value" x))] - [(or (fixnum? x) (ratnum? x) (bignum? x)) x] - [else - (die 'inexact->exact "not an inexact number" x)])) + (die who "number has no real value" x))] + [(cflonum? x) + (make-rectangular + (or ($flonum->exact ($cflonum-real x)) + (die who "number has no real value" x)) + (or ($flonum->exact ($cflonum-imag x)) + (die who "number has no real value" x)))] + [(or (fixnum? x) (ratnum? x) (bignum? x) (compnum? x)) x] + [else (die who "not a number" x)])) - (define (exact x) - (cond - [(flonum? x) - (or ($flonum->exact x) - (die 'exact "no real value" x))] - [(or (fixnum? x) (ratnum? x) (bignum? x)) x] - [else - (die 'exact "not an inexact number" x)])) + (define (inexact->exact x) ($exact x 'inexact->exact)) + (define (exact x) ($exact x 'exact)) (define (flpositive? x) diff --git a/scheme/last-revision b/scheme/last-revision index 2358ac3..c102fe8 100644 --- a/scheme/last-revision +++ b/scheme/last-revision @@ -1 +1 @@ -1755 +1756