~ chicken-core (master) aa576aef118ea946b6736e01611495ce2c57f562
commit aa576aef118ea946b6736e01611495ce2c57f562
Author: Peter McGoron <code@mcgoron.com>
AuthorDate: Wed Jul 29 16:33:41 2026 -0400
Commit: Felix Winkelmann <felix.winkelmann@bevuta.com>
CommitDate: Wed Sep 9 13:45:42 2026 +0200
modify "inexact expt with complex number, real result" case
Although (expt +1 6) is exactly -1 (expt 0.0+1.0i) has an inexact
zero real part. This means that the number is only approximately
on the imaginary axis. Hence -1.0+0.0i is the correct answer, as
a small perturbation e would mean that this is calulating
(e + 1.0i)^6 = -1.0 + e^6 + e^5*1.0i + ...
so it might have an imaginary part.
diff --git a/tests/numbers-test.scm b/tests/numbers-test.scm
index 4ff49d8d..a36d6bf7 100644
--- a/tests/numbers-test.scm
+++ b/tests/numbers-test.scm
@@ -778,7 +778,8 @@
(test-equal "exact expt with complex number" (expt 0+1i 5) 0+1i)
(test-equal "exact expt with complex number, real result" (expt 0+1i 6) -1)
(test-equal "inexact expt with complex number" (expt 0.0+1.0i 5.0) 0.0+1.0i)
- (test-equal "inexact expt with complex number, real result" (expt 0.0+1.0i 6.0) -1.0)
+ (test-equal "inexact expt with complex number, real result"
+ (expt 0.0+1.0i 6.0) -1.0+0.0i)
(parameterize ((current-test-epsilon 1e-10))
(test-equal "inexact noninteger expt with complex number"
(expt 0.0+4.0i 0.5) 1.4142135623731+1.41421356237309i)
Trap