Skip to content
Snippets Groups Projects
Commit e8ca479f authored by pfdietz's avatar pfdietz
Browse files

Added more informative output for a division test, and a comment explaining a...

Added more informative output for a division test, and a comment explaining a point about complex reciprocal.  Add ignore-errors wrappers for some compile-and-load forms.
parent 18f07f13
No related branches found
No related tags found
No related merge requests found
...@@ -96,15 +96,21 @@ ...@@ -96,15 +96,21 @@
collect (list i c r)) collect (list i c r))
nil) nil)
;;; This test will fail if you compute complex reciprocals
;;; naively. If z = a + bi, the naive approach computes
;;; z^-1 = c + di as c = a/(a^2+b^2), d = -b/(a^2+b^2).
;;; That loses precision, however. Instead, the implementation
;;; should do c = 1/(a+b/a), d = -1/(a/b+b).
(deftest /.7 (deftest /.7
(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)
nconc nconc
(loop for i = (1+ (random bound)) (loop for i = (1+ (random bound))
for c = (complex 0 i) for c = (complex 0 i)
for r = (/ c) for r = (/ c)
repeat 10000 repeat 1000
unless (eql r (complex 0 (- (/ i)))) unless (= r (complex 0 (- (/ i))))
collect (list i c r))) collect (list i c r (complex 0 (- (/ i))))))
nil) nil)
(deftest /.8 (deftest /.8
......
...@@ -10,7 +10,3 @@ ...@@ -10,7 +10,3 @@
(progn (apply #'/ args) (values)) (progn (apply #'/ args) (values))
(division-by-zero () (values)) (division-by-zero () (values))
(condition (c) c))) (condition (c) c)))
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
(in-package :cl-test) (in-package :cl-test)
(compile-and-load "numbers-aux.lsp") (compile-and-load "numbers-aux.lsp")
(compile-and-load "fceiling-aux.lsp") (ignore-errors (compile-and-load "fceiling-aux.lsp"))
(deftest fceiling.error.1 (deftest fceiling.error.1
(classify-error (fceiling)) (classify-error (fceiling))
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
(in-package :cl-test) (in-package :cl-test)
(compile-and-load "numbers-aux.lsp") (compile-and-load "numbers-aux.lsp")
(compile-and-load "ffloor-aux.lsp") (ignore-errors (compile-and-load "ffloor-aux.lsp"))
(deftest ffloor.error.1 (deftest ffloor.error.1
(classify-error (ffloor)) (classify-error (ffloor))
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
(in-package :cl-test) (in-package :cl-test)
(compile-and-load "numbers-aux.lsp") (compile-and-load "numbers-aux.lsp")
(compile-and-load "fround-aux.lsp") (ignore-errors (compile-and-load "fround-aux.lsp"))
(deftest fround.error.1 (deftest fround.error.1
(classify-error (fround)) (classify-error (fround))
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
(in-package :cl-test) (in-package :cl-test)
(compile-and-load "numbers-aux.lsp") (compile-and-load "numbers-aux.lsp")
(compile-and-load "ftruncate-aux.lsp") (ignore-errors (compile-and-load "ftruncate-aux.lsp"))
(deftest ftruncate.error.1 (deftest ftruncate.error.1
(classify-error (ftruncate)) (classify-error (ftruncate))
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment