New definition of `complex:acos' preserves more precision and is more
authorChris Hanson <org/chris-hanson/cph>
Fri, 2 Feb 1990 17:25:50 +0000 (17:25 +0000)
committerChris Hanson <org/chris-hanson/cph>
Fri, 2 Feb 1990 17:25:50 +0000 (17:25 +0000)
efficient.  This one also does not introduce inexact real or imaginary
zero components in certain (important) boundary cases, such as:

(acos 2)
;Value: 0.+1.3169578969248166i

v7/src/runtime/arith.scm

index 09c6c099a896da4784b24933809922be6811d0e3..f2dae1041b37be1becc80732acdf7a9baf209f76 100644 (file)
@@ -1,8 +1,8 @@
 #| -*-Scheme-*-
 
-$Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/runtime/arith.scm,v 1.13 1990/01/11 01:01:44 cph Exp $
+$Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/runtime/arith.scm,v 1.14 1990/02/02 17:25:50 cph Exp $
 
-Copyright (c) 1989 Massachusetts Institute of Technology
+Copyright (c) 1989, 1990 Massachusetts Institute of Technology
 
 This material was developed by the Scheme project at the Massachusetts
 Institute of Technology, Department of Electrical Engineering and
@@ -1396,7 +1396,11 @@ MIT in each case. |#
   (if (or (recnum? z)
          (real:< z -1)
          (real:< 1 z))
-      (complex:- rec:pi/2 (complex:asin z))
+      (complex:-i*
+       (complex:log
+       (complex:+ z
+                  (complex:+i*
+                   (complex:sqrt (complex:- 1 (complex:* z z)))))))
       ((copy real:acos) z)))
 
 (define (complex:atan z)