From 0202ead8ed72b8ca622aad116fd41373948c167f Mon Sep 17 00:00:00 2001 From: Kevin Ryde Date: Tue, 12 Dec 2006 22:46:33 +0000 Subject: [PATCH] (*): Exercise multiply by exact 0 giving exact 0. --- test-suite/tests/numbers.test | 44 ++++++++++++++++++++++++++++++++++- 1 file changed, 43 insertions(+), 1 deletion(-) diff --git a/test-suite/tests/numbers.test b/test-suite/tests/numbers.test index 40ca48ebc..2c004f556 100644 --- a/test-suite/tests/numbers.test +++ b/test-suite/tests/numbers.test @@ -2459,10 +2459,52 @@ (with-test-prefix "*" + (with-test-prefix "inum * bignum" + + (pass-if "0 * 2^256 = 0" + (eqv? 0 (* 0 (ash 1 256))))) + + (with-test-prefix "inum * flonum" + + (pass-if "0 * 1.0 = 0" + (eqv? 0 (* 0 1.0)))) + + (with-test-prefix "inum * complex" + + (pass-if "0 * 1+1i = 0" + (eqv? 0 (* 0 1+1i)))) + + (with-test-prefix "inum * frac" + + (pass-if "0 * 2/3 = 0" + (eqv? 0 (* 0 2/3)))) + + (with-test-prefix "bignum * inum" + + (pass-if "2^256 * 0 = 0" + (eqv? 0 (* (ash 1 256) 0)))) + + (with-test-prefix "flonum * inum" + + ;; in guile 1.6.8 and 1.8.1 and earlier this returned inexact 0.0 + (pass-if "1.0 * 0 = 0" + (eqv? 0 (* 1.0 0)))) + + (with-test-prefix "complex * inum" + + ;; in guile 1.6.8 and 1.8.1 and earlier this returned inexact 0.0 + (pass-if "1+1i * 0 = 0" + (eqv? 0 (* 1+1i 0)))) + (pass-if "complex * bignum" (let ((big (ash 1 90))) (= (make-rectangular big big) - (* 1+1i big))))) + (* 1+1i big)))) + + (with-test-prefix "frac * inum" + + (pass-if "2/3 * 0 = 0" + (eqv? 0 (* 2/3 0))))) ;;; ;;; /