T.R | Title | User | Personal Name | Date | Lines |
---|
799.1 | IXP gets the right answer | SQM::HALLYB | Khan or bust! | Thu Dec 10 1987 12:03 | 1 |
|
|
799.2 | What's IXP? | MATRIX::ROTH | May you live in interesting times | Thu Dec 10 1987 12:50 | 10 |
|
< Note 799.1 by SQM::HALLYB "Khan or bust!" >
-< IXP gets the right answer >-
What's IXP?
I have MP, but didn't try it. I did try LISP and reproduced the
error...
- Jim
|
799.3 | Request for Test Problems | 38464::DERAMO | Now let's see, 1 + 1 = ... | Thu Dec 10 1987 12:53 | 6 |
| Does anyone know of a set of test problems with known
answers for debugging bignum arithmetic routines? Should
the test be run before or after the formal program
correctness proof?
Dan
|
799.4 | Aha! A pattern emerges. | ZFC::DERAMO | Avid NOTES reader | Thu Dec 10 1987 15:30 | 53 |
| ; Compile this VAX LISP file and call the MATH function to
; generate 2236 examples of the bug in .0. The search is over
; numbers of the form 2^i +/- 2^j +/- 1. I don't recall seeing
; incorrect squares when both signs were positive. The computed
; squares [when incorrect] were always too small, almost always
; by an integral power of 2^32.
; Without reading the code, can you now determine the bug? :-)
(defun test (x y z i j)
(declare (integer x y) (fixnum z i j))
(let* ((a (+ x y z))
(e (- (the integer (* a a))
(the integer (+ (the integer (* x x))
(the integer (* y y))
(the fixnum (* z z))
(the integer (* 2 x y))
(the integer (* 2 x z))
(the integer (* 2 y z)))))))
(declare (integer a e))
; a = x + y + z = 2^j +/- 2^j +/ 1
; e = a^2 as computed by VAX LISP - the true a^2
(unless (= e 0)
(format t "2^~3D ~A 2^~2D ~A 1 squared is too ~A"
i
(if (> y 0) '+ '-)
j
(if (> z 0) '+ '-)
(if (> e 0) "large" "small"))
(let ((n (truncate (+ 0.5l0 (/ (log (float (abs e) 0.0l0))
(log 2.0l0))))))
(declare (fixnum n))
(if (= (abs e) (expt 2 n))
(format t " by 2^~3D.~%" n)
(format t ".~%"))))))
(defun math ()
(do ((i 75 (1+ i)))
((> i 124))
(declare (fixnum i))
(let ((x (expt 2 i)))
(declare (integer x))
(do ((j 36 (1+ j)))
((> j 70))
(declare (fixnum j))
(let ((y (expt 2 j))
(signs '(-1 1)))
(declare (integer y))
(dolist (sign1 signs)
(declare (fixnum sign1))
(dolist (sign2 signs)
(declare (fixnum sign2))
(test x (the integer (* y sign1)) sign2 i j))))))))
|
799.5 | Abridged list of examples from .-1 | ZFC::DERAMO | Avid NOTES reader | Thu Dec 10 1987 15:34 | 39 |
| 2^ 75 + 2^43 - 1 squared is too small by 2^ 96.
2^ 75 - 2^64 - 1 squared is too small by 2^128.
2^ 75 + 2^64 - 1 squared is too small by 2^128.
2^ 75 - 2^65 - 1 squared is too small by 2^128.
2^ 75 + 2^65 - 1 squared is too small by 2^128.
2^ 75 - 2^66 - 1 squared is too small by 2^128.
2^ 75 + 2^66 - 1 squared is too small by 2^128.
2^ 75 - 2^67 - 1 squared is too small by 2^128.
2^ 75 + 2^67 - 1 squared is too small by 2^128.
2^ 75 - 2^68 - 1 squared is too small by 2^128.
2^ 75 + 2^68 - 1 squared is too small by 2^128.
2^ 75 - 2^69 - 1 squared is too small by 2^128.
2^ 75 + 2^69 - 1 squared is too small by 2^128.
2^ 75 - 2^70 - 1 squared is too small by 2^128.
2^ 75 + 2^70 - 1 squared is too small by 2^128.
2^ 76 + 2^44 - 1 squared is too small by 2^ 96.
2^ 76 - 2^64 - 1 squared is too small by 2^128.
2^ 76 + 2^64 - 1 squared is too small by 2^128.
.
. [2200 lines deleted]
.
2^124 + 2^57 - 1 squared is too small by 2^160.
2^124 - 2^58 - 1 squared is too small by 2^160.
2^124 - 2^58 + 1 squared is too small by 2^ 96.
2^124 + 2^58 - 1 squared is too small by 2^160.
2^124 - 2^59 - 1 squared is too small by 2^160.
2^124 - 2^59 + 1 squared is too small by 2^ 96.
2^124 + 2^59 - 1 squared is too small by 2^160.
2^124 - 2^60 - 1 squared is too small by 2^160.
2^124 - 2^60 + 1 squared is too small by 2^ 96.
2^124 + 2^60 - 1 squared is too small by 2^160.
2^124 - 2^61 - 1 squared is too small by 2^160.
2^124 - 2^61 + 1 squared is too small.
2^124 + 2^61 - 1 squared is too small by 2^160.
2^124 - 2^62 - 1 squared is too small by 2^160.
2^124 - 2^62 + 1 squared is too small.
2^124 + 2^62 - 1 squared is too small by 2^160.
2^124 - 2^63 - 1 squared is too small by 2^160.
2^124 - 2^63 + 1 squared is too small.
|