1.0.6.13: minor fix to the compiler's interval-arithmetic
authorNikodemus Siivola <nikodemus@random-state.net>
Sat, 2 Jun 2007 10:50:59 +0000 (10:50 +0000)
committerNikodemus Siivola <nikodemus@random-state.net>
Sat, 2 Jun 2007 10:50:59 +0000 (10:50 +0000)
 * When calculating the interval of (* some-number constant-zero),
   multiply the signums of the interval endpoints, not the numbers
   themselves: this avoids compile-time breakage when the zero is a
   float and the non-zero number is too large to be represented as a
   float.

src/compiler/srctran.lisp
tests/compiler.pure.lisp
version.lisp-expr

index c39aeff..359e2f3 100644 (file)
                   ;; Multiply by closed zero is special. The result
                   ;; is always a closed bound. But don't replace this
                   ;; with zero; we want the multiplication to produce
-                  ;; the correct signed zero, if needed.
-                  (* (type-bound-number x) (type-bound-number y)))
+                  ;; the correct signed zero, if needed. Use SIGNUM
+                  ;; to avoid trying to multiply huge bignums with 0.0.
+                  (* (signum (type-bound-number x)) (signum (type-bound-number y))))
                  ((or (and (floatp x) (float-infinity-p x))
                       (and (floatp y) (float-infinity-p y)))
                   ;; Infinity times anything is infinity
index 4b3d1de..c5997a4 100644 (file)
 
 ;;; bug in adding DATA-VECTOR-REF-WITH-OFFSET to x86-64
 (assert (not (mismatch #(1.0f0 2.0f0) (make-array 2 :element-type 'single-float :initial-contents (list 1.0f0 2.0f0)))))
+
+;;; bug in interval-arithmetic used by the compiler: needless attempt to coerce too
+;;; large bignums to floats
+(dolist (op '(* / + -))
+  (let ((fun (compile
+              nil
+              `(lambda (x)
+                 (declare (type (integer 0 #.(* 2 (truncate most-positive-double-float))) x))
+                 (,op 0.0d0 x)))))
+    (loop repeat 10
+          do (let ((arg (random (truncate most-positive-double-float))))
+               (assert (eql (funcall fun arg)
+                            (funcall op 0.0d0 arg)))))))
index b43fe4a..0bd006d 100644 (file)
@@ -17,4 +17,4 @@
 ;;; checkins which aren't released. (And occasionally for internal
 ;;; versions, especially for internal versions off the main CVS
 ;;; branch, it gets hairier, e.g. "0.pre7.14.flaky4.13".)
-"1.0.6.12"
+"1.0.6.13"