~ chicken-core (master) ef2ffa3bdf01b49369a44965b1852a42d3621429
commit ef2ffa3bdf01b49369a44965b1852a42d3621429
Author: Peter McGoron <code@mcgoron.com>
AuthorDate: Wed Jul 29 16:31:51 2026 -0400
Commit: Felix Winkelmann <felix.winkelmann@bevuta.com>
CommitDate: Wed Sep 9 13:45:42 2026 +0200
Multiplication will only return a cplxnum if the imaginary part is exactly zero.
This breaks one test case which will be addressed.
diff --git a/runtime.c b/runtime.c
index a8cc891e..abe56584 100644
--- a/runtime.c
+++ b/runtime.c
@@ -8032,7 +8032,8 @@ cplx_times(C_word **ptr, C_word rx, C_word ix, C_word ry, C_word iy)
clear_buffer_object(ab, i1);
clear_buffer_object(ab, i2);
- if (C_truep(C_u_i_zerop2(i))) return r;
+ if (i == C_fix(0))
+ return r;
else return C_cplxnum(ptr, r, i);
}
diff --git a/tests/numbers-test.scm b/tests/numbers-test.scm
index 90809c96..4ff49d8d 100644
--- a/tests/numbers-test.scm
+++ b/tests/numbers-test.scm
@@ -165,6 +165,8 @@
(test-equal "*: (* 0 +inf.0) => 0" (* 0 +inf.0) 0)
(test-equal "*: (* 0 -inf.0) => 0" (* 0 -inf.0) 0)
(test-equal "*: (* 0 +nan.0) => 0" (* 0 +nan.0) 0)
+ (test-equal "*: (* 1 0.0+inf.0i) => 0.0+inf.0i" (* 1 0.0+inf.0i) 0.0+inf.0i)
+ (test-equal "*: (* +i 0.0+inf.0i) => -inf.0+0.0i" (* +i 0.0+inf.0i) -inf.0+0.0i)
)
(test-group "division"
Trap