~ chicken-core (master) 22860196304c17a687c3287a76a91365e6cf3833
commit 22860196304c17a687c3287a76a91365e6cf3833
Author: Peter McGoron <code@mcgoron.com>
AuthorDate: Thu Jul 30 11:04:33 2026 -0400
Commit: Felix Winkelmann <felix.winkelmann@bevuta.com>
CommitDate: Wed Sep 9 13:45:43 2026 +0200
Modify special cases for asin
The constants come from Gambit, but Gambit has mixed-exactness complex
numbers and has its numeric system designed with that in mind. CHICKEN
does not have those, although it has real numbers, which are a subset
of mixed-exactness complex numbers. This upgrades unsigned 0 to signed
zero because that is the most sensible thing to do (in the absense
of mixed exactness). This causes a change to the constants.
diff --git a/library.scm b/library.scm
index 4a5fbdfc..9647b27f 100644
--- a/library.scm
+++ b/library.scm
@@ -2778,10 +2778,15 @@ EOF
;; These should fall out of the algorithm below,
;; but inexactness-promotion rules end up generating
;; a NaN somewhere.
- ((eqv? n -inf.0)
- -1.5707963267948966+inf.0i)
- ((eqv? n +inf.0)
- 1.5707963267948966-inf.0i)
+ ;;
+ ;; These are the special cases -inf.0+0.0i and
+ ;; +inf.0+0.0i from Gambit. Since Gambit has mixed exactness numbers,
+ ;; this doesn't copy -inf.0+0i and +inf.0+0i. Basically, unsigned
+ ;; zero is approached counterclockwise, and signed zero from the
+ ;; side with that sign. So unsigned zero approches from the bottom
+ ;; and matches -0.0, which is probably not what we want.
+ ((eqv? n +inf.0) 1.5707963267948966+inf.0i)
+ ((eqv? n -inf.0) -1.5707963267948966+inf.0i)
(else
(let* ((x (real-part n))
(s:1-n (sqrt (- 1 n)))
Trap