diff --git a/test-suite/tests/numbers.test b/test-suite/tests/numbers.test index 3d6beb887..d56a4d883 100644 --- a/test-suite/tests/numbers.test +++ b/test-suite/tests/numbers.test @@ -1369,6 +1369,54 @@ ;;; / ;;; +(with-test-prefix "/" + + (with-test-prefix "1/complex" + + (pass-if "0+1i" + (eqv? 0-1i (/ 0+1i))) + + ;; in guile 1.6 through 1.6.7 this incorrectly resulted in nans + (pass-if "0-1i" + (eqv? 0+1i (/ 0-1i))) + + (pass-if "1+1i" + (eqv? 0.5-0.5i (/ 1+1i))) + + (pass-if "1-1i" + (eqv? 0.5+0.5i (/ 1-1i))) + + (pass-if "-1+1i" + (eqv? -0.5-0.5i (/ -1+1i))) + + (pass-if "-1-1i" + (eqv? -0.5+0.5i (/ -1-1i))) + + (pass-if "(/ 3+4i)" + (= (/ 3+4i) 0.12-0.16i)) + + (pass-if "(/ 4+3i)" + (= (/ 4+3i) 0.16-0.12i)) + + (pass-if "(/ 1e200+1e200i)" + (= (/ 1e200+1e200i) 5.0e-201-5.0e-201i))) + + (with-test-prefix "inum/complex" + + (pass-if "(/ 25 3+4i)" + (= (/ 25 3+4i) 3.0-4.0i)) + + (pass-if "(/ 25 4+3i)" + (= (/ 25 4+3i) 4.0-3.0i))) + + (with-test-prefix "complex/complex" + + (pass-if "(/ 25+125i 3+4i)" + (= (/ 25+125i 3+4i) 23.0+11.0i)) + + (pass-if "(/ 25+125i 4+3i)" + (= (/ 25+125i 4+3i) 19.0+17.0i)))) + ;;; ;;; truncate ;;;