From: Taylor R Campbell Date: Sun, 18 Nov 2018 03:36:52 +0000 (+0000) Subject: Teach (log1p x) to return complex results for real x < -1. X-Git-Tag: mit-scheme-pucked-10.1.2~16^2~37 X-Git-Url: https://birchwood-abbey.net/git?a=commitdiff_plain;h=f3a2daf645ff0415ead5a67b311b14d7e9ac78cb;p=mit-scheme.git Teach (log1p x) to return complex results for real x < -1. --- diff --git a/src/runtime/arith.scm b/src/runtime/arith.scm index d8e0b5faa..e5409c8cd 100644 --- a/src/runtime/arith.scm +++ b/src/runtime/arith.scm @@ -1744,7 +1744,9 @@ USA. ((copy real:expm1) z))) (define (complex:log1p z) - (if (recnum? z) + (if (or (recnum? z) + (and (real:real? z) + (<= z -1))) (complex:log (complex:+ z 1)) ;XXX ((copy real:log1p) z))) diff --git a/tests/runtime/test-arith.scm b/tests/runtime/test-arith.scm index 362087ec6..c93f276d5 100644 --- a/tests/runtime/test-arith.scm +++ b/tests/runtime/test-arith.scm @@ -252,7 +252,7 @@ USA. (list 0.25 .22314355131420976) (list (- 1 (sqrt 1/2)) 0.25688251232181475) (list 0.3 .26236426446749106) - (list -2 +3.141592653589793i 'xfail)) + (list -2 +3.141592653589793i)) (lambda (v) (let ((x (car v)) (z (cadr v))