From e8ca479f8f259f33c0705b4ecbb5909965a5edb2 Mon Sep 17 00:00:00 2001
From: pfdietz <pfdietz@localhost>
Date: Mon, 1 Sep 2003 22:10:34 +0000
Subject: [PATCH] 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.

---
 ansi-tests/divide.lsp       | 12 +++++++++---
 ansi-tests/division-aux.lsp |  4 ----
 ansi-tests/fceiling.lsp     |  2 +-
 ansi-tests/ffloor.lsp       |  2 +-
 ansi-tests/fround.lsp       |  2 +-
 ansi-tests/ftruncate.lsp    |  2 +-
 6 files changed, 13 insertions(+), 11 deletions(-)

diff --git a/ansi-tests/divide.lsp b/ansi-tests/divide.lsp
index 3ee4a567..0252718a 100644
--- a/ansi-tests/divide.lsp
+++ b/ansi-tests/divide.lsp
@@ -96,15 +96,21 @@
 	collect (list i c r))
   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
   (loop for bound in (list 1.0s5 1.0f10 1.0d20 1.0l20)
 	nconc
 	(loop for i = (1+ (random bound))
 	      for c = (complex 0 i)
 	      for r = (/ c)
-	      repeat 10000
-	      unless (eql r (complex 0 (- (/ i))))
-	      collect (list i c r)))
+	      repeat 1000
+	      unless (= r (complex 0 (- (/ i))))
+	      collect (list i c r (complex 0 (- (/ i))))))
   nil)
 
 (deftest /.8
diff --git a/ansi-tests/division-aux.lsp b/ansi-tests/division-aux.lsp
index d129a67c..2cb3c3b4 100644
--- a/ansi-tests/division-aux.lsp
+++ b/ansi-tests/division-aux.lsp
@@ -10,7 +10,3 @@
    (progn (apply #'/ args) (values))
    (division-by-zero () (values))
    (condition (c) c)))
-
-
-
-		
diff --git a/ansi-tests/fceiling.lsp b/ansi-tests/fceiling.lsp
index b7caefd0..b6496e2c 100644
--- a/ansi-tests/fceiling.lsp
+++ b/ansi-tests/fceiling.lsp
@@ -6,7 +6,7 @@
 (in-package :cl-test)
 
 (compile-and-load "numbers-aux.lsp")
-(compile-and-load "fceiling-aux.lsp")
+(ignore-errors (compile-and-load "fceiling-aux.lsp"))
 
 (deftest fceiling.error.1
   (classify-error (fceiling))
diff --git a/ansi-tests/ffloor.lsp b/ansi-tests/ffloor.lsp
index 69088467..74f348db 100644
--- a/ansi-tests/ffloor.lsp
+++ b/ansi-tests/ffloor.lsp
@@ -6,7 +6,7 @@
 (in-package :cl-test)
 
 (compile-and-load "numbers-aux.lsp")
-(compile-and-load "ffloor-aux.lsp")
+(ignore-errors (compile-and-load "ffloor-aux.lsp"))
 
 (deftest ffloor.error.1
   (classify-error (ffloor))
diff --git a/ansi-tests/fround.lsp b/ansi-tests/fround.lsp
index 1a94c6a9..29439397 100644
--- a/ansi-tests/fround.lsp
+++ b/ansi-tests/fround.lsp
@@ -6,7 +6,7 @@
 (in-package :cl-test)
 
 (compile-and-load "numbers-aux.lsp")
-(compile-and-load "fround-aux.lsp")
+(ignore-errors (compile-and-load "fround-aux.lsp"))
 
 (deftest fround.error.1
   (classify-error (fround))
diff --git a/ansi-tests/ftruncate.lsp b/ansi-tests/ftruncate.lsp
index 86df3340..406d994a 100644
--- a/ansi-tests/ftruncate.lsp
+++ b/ansi-tests/ftruncate.lsp
@@ -6,7 +6,7 @@
 (in-package :cl-test)
 
 (compile-and-load "numbers-aux.lsp")
-(compile-and-load "ftruncate-aux.lsp")
+(ignore-errors (compile-and-load "ftruncate-aux.lsp"))
 
 (deftest ftruncate.error.1
   (classify-error (ftruncate))
-- 
GitLab