[gambit-list] fix to ##acos
Bradley Lucier
lucier at math.purdue.edu
Mon Aug 11 01:14:47 EDT 2008
I ran the trigonometric test suite alluded to at
http://groups.google.com/group/comp.lang.scheme/msg/3c7c4db3800e3c6f
and found a problem with complex acos; the following "fixes" it. Gambit
now "fails" 4 tests (2 for acos, 2 for asin) due to "catastrophic
cancellation" for very large arguments. I don't know how to fix them at
the moment, or, indeed, whether they're worth fixing:
frying-pan:~/programs/gambc-v4_2_3/snd-9/tools> ../../gsi/gsi test.scm
;(asin 1234000000.+0.i) got 0.+inf.0i, but expected 1.5707963267949+21.62667394298955i
;(asin -1234000000.-0.i) got -0.-inf.0i, but expected -1.5707963267949+21.62667394298955i
;(acos 1234000000.+0.i) got 1.5707963267948966-inf.0i, but expected 0.-21.62667394298955i
;(acos -1234000000.-0.i) got 1.5707963267948966+inf.0i, but expected 3.14159265358979-21.62667394298955i
;all done!
Brad
hg diff lib/_num.scm
diff -r 0e938061d9b6 lib/_num.scm
--- a/lib/_num.scm Tue Jun 03 01:22:39 2008 -0400
+++ b/lib/_num.scm Mon Aug 11 01:04:40 2008 -0400
@@ -2160,9 +2160,7 @@
(##fail-check-number 1 acos x))
(define (complex-case x)
- (##* (macro-cpxnum--i)
- (##log (##+ x
- (##* (macro-cpxnum-+i) (##sqrt (##- 1 (##* x x))))))))
+ (##- (macro-inexact-+pi/2) (##asin x)))
(define (real-case x)
(if (or (##< x -1) (##< 1 x))
More information about the Gambit-list
mailing list