Fixes more of bug 180170: (log (expt 2 1024)) now works.

This commit is contained in:
Abdulaziz Ghuloum 2008-01-05 21:02:52 -05:00
parent af6562721b
commit da7f05a538
3 changed files with 21 additions and 6 deletions

View File

@ -657,7 +657,9 @@
(string? (syntax->datum #'str))
#'(let-syntax ([foo
(lambda (t)
(list #'quote (pregexp-proc str)))])
(with-syntax ([c (datum->syntax #'_
(pregexp-proc str))])
#'(quote c)))])
foo)]
[(_ args ...) #'(pregexp-proc args ...)]
[id (identifier? #'id) #'pregexp-proc])))

View File

@ -2076,7 +2076,9 @@
(cond
[(infinite? v) (inexact s)]
[else v]))]))]
[(ratnum? x) (/ (sqrt ($ratnum-n x)) (sqrt ($ratnum-d x)))]
[(ratnum? x)
;;; FIXME: incorrect as per bug 180170
(/ (sqrt ($ratnum-n x)) (sqrt ($ratnum-d x)))]
[else (die 'sqrt "BUG: unsupported" x)])))
(define flsqrt
@ -2248,12 +2250,23 @@
[($fx= x 0) (die 'log "undefined around 0")]
[($fx> x 0) (foreign-call "ikrt_fx_log" x)]
[else (die 'log "negative argument" x)])]
[(flonum? x)
[(flonum? x)
(cond
[(>= x 0) (foreign-call "ikrt_fl_log" x)]
[else (die 'log "negative argument" x)])]
[(bignum? x) (log (exact->inexact x))]
[(ratnum? x) (- (log (numerator x)) (log (denominator x)))]
[(bignum? x)
;;; FIXME: incorrect as per bug 180170
(unless ($bignum-positive? x)
(die 'log "negative argument" x))
(let ([v (log (inexact x))])
(cond
[(infinite? v)
(let-values ([(s r) (exact-integer-sqrt x)])
(fl* 2.0 (log s)))]
[else v]))]
[(ratnum? x)
;;; FIXME: incorrect as per bug 180170
(- (log (numerator x)) (log (denominator x)))]
[else (die 'log "not a number" x)])))
(define string->number

View File

@ -1 +1 @@
1329
1330