~ chicken-core (master) 6169ab9c3a1b6d2efa180976396e9f6e71a309e7
commit 6169ab9c3a1b6d2efa180976396e9f6e71a309e7
Author: felix <felix@call-with-current-continuation.org>
AuthorDate: Tue Jul 14 21:18:25 2026 +0200
Commit: felix <felix@call-with-current-continuation.org>
CommitDate: Tue Jul 14 21:18:25 2026 +0200
update tests and NEWS to complex number syntax changes
diff --git a/NEWS b/NEWS
index c30dd083..75d41067 100644
--- a/NEWS
+++ b/NEWS
@@ -86,12 +86,16 @@
- Added `expand1' to (chicken syntax) module for expanding a macro
only once, also added the ",x1" command to "csi" for this.
- Added the (chicken version) module.
- - "delete-file*" and "delete-file" now behave consistently with
+ - `delete-file*' and `delete-file' now behave consistently with
broken symlinks.
- - number->string now accepts bases up to 36, where before it only accepted
+ - `number->string' now accepts bases up to 36, where before it only accepted
bases up to 16 (thanks to Diego A. Mundo)
- - string->number now handles ambiguous cases involving the character "i"
+ - `string->number' now handles ambiguous cases involving the character "i"
in bases higher than 18 more consistently.
+ - `make-rectangular' returns a complex number if the imaginary part
+ is inexact zero.
+ - `string->number' and the reader accept and handle correctly complex
+ numbers with a negative inexact zero as the imaginary part.
- Syntax expander:
- `syntax-rules' attempts to better support tail patterns with ellipses
diff --git a/tests/numbers-test-gauche.scm b/tests/numbers-test-gauche.scm
index ae7ecaf7..b44a51f3 100644
--- a/tests/numbers-test-gauche.scm
+++ b/tests/numbers-test-gauche.scm
@@ -460,11 +460,11 @@
(test-equal "complex reader" (decompose-complex '-1.i) '(0.0 -1.0))
(test-equal "complex reader" (decompose-complex '+1.0i) '(0.0 1.0))
(test-equal "complex reader" (decompose-complex '-1.0i) '(0.0 -1.0))
-(test-equal "complex reader" (decompose-complex '1+0.0i) 1.0)
-(test-equal "complex reader" (decompose-complex '1+.0i) 1.0)
-(test-equal "complex reader" (decompose-complex '1+0.i) 1.0)
-(test-equal "complex reader" (decompose-complex '1+0.0e-43i) 1.0)
-(test-equal "complex reader" (decompose-complex '1e2+0.0e-43i) 100.0)
+(test-equal "complex reader" (decompose-complex '1+0.0i) '(1.0 0.0))
+(test-equal "complex reader" (decompose-complex '1+.0i) '(1.0 0.0))
+(test-equal "complex reader" (decompose-complex '1+0.i) '(1.0 0.0))
+(test-equal "complex reader" (decompose-complex '1+0.0e-43i) '(1.0 0.0))
+(test-equal "complex reader" (decompose-complex '1e2+0.0e-43i) '(100.0 0.0))
(test-equal "complex reader" (decompose-complex 'i) 'i)
(test-equal "complex reader" (decompose-complex (string->number ".i")) #f)
@@ -478,7 +478,7 @@
(test-equal "complex reader" (decompose-complex 1/2+1/2i) '(1/2 1/2))
(test-equal "complex reader" (decompose-complex 0+1/2i) '(0 1/2))
(test-equal "complex reader" (decompose-complex -1/2i) '(0 -1/2))
-(test-equal "complex reader" (decompose-complex 1/2-0/2i) 1/2)
+(test-equal "complex reader" (decompose-complex 1/2-0/2i) '1/2)
;; The following is also invalid R5RS syntax, so it's commented out
#;(test-equal "complex reader" (decompose-complex (string->number "1/2-1/0i")) '(0.5 -inf.0))
diff --git a/tests/numbers-test.scm b/tests/numbers-test.scm
index b8b3f065..5731f06e 100644
--- a/tests/numbers-test.scm
+++ b/tests/numbers-test.scm
@@ -835,7 +835,7 @@
(test-equal "complex?" (complex? c1) #t)
(test-equal "complex?" (complex? 3) #t)
(test-equal "real?" (real? 3) #t)
- (test-equal "real?" (real? (make-rectangular -2.5 0.0)) #t)
+ (test-equal "real?" (real? (make-rectangular -2.5 0.0)) #f)
(test-equal "real?" (real? -2+1i) #f)
(test-equal "real?" (real? 1e0) #t)
(test-equal "rational?" (rational? (/ 6 10)) #t)
Trap