/[gcl]/gcl/ansi-tests/divide.lsp
ViewVC logotype

Diff of /gcl/ansi-tests/divide.lsp

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.1 by pfdietz, Mon Sep 1 19:13:25 2003 UTC revision 1.2 by pfdietz, Mon Sep 1 22:10:34 2003 UTC
# Line 96  Line 96 
96          collect (list i c r))          collect (list i c r))
97    nil)    nil)
98    
99    ;;; This test will fail if you compute complex reciprocals
100    ;;; naively.  If z = a + bi, the naive approach computes
101    ;;; z^-1 = c + di as c = a/(a^2+b^2), d = -b/(a^2+b^2).
102    ;;; That loses precision, however.  Instead, the implementation
103    ;;; should do c = 1/(a+b/a), d = -1/(a/b+b).
104    
105  (deftest /.7  (deftest /.7
106    (loop for bound in (list 1.0s5 1.0f10 1.0d20 1.0l20)    (loop for bound in (list 1.0s5 1.0f10 1.0d20 1.0l20)
107          nconc          nconc
108          (loop for i = (1+ (random bound))          (loop for i = (1+ (random bound))
109                for c = (complex 0 i)                for c = (complex 0 i)
110                for r = (/ c)                for r = (/ c)
111                repeat 10000                repeat 1000
112                unless (eql r (complex 0 (- (/ i))))                unless (= r (complex 0 (- (/ i))))
113                collect (list i c r)))                collect (list i c r (complex 0 (- (/ i))))))
114    nil)    nil)
115    
116  (deftest /.8  (deftest /.8

Legend:
Removed from v.1.1  
changed lines
  Added in v.1.2

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26