Re: imag-part of a real and non-complex number should be exact zero
Felix Winkelmann via Chicken-users <[email protected]> Tue, 28 Jul 2026 13:21:51 +0200
| Newsgroups | gmane.lisp.scheme.chicken |
|---|---|
| Message-ID | <[email protected]> |
On Mon Jul 27, 2026 at 10:16 PM CEST, Peter McGoron via Chicken-users wrote= : > For example, `(imag-part 1.0)` should evaluate to `0`, not `0.0`. > > Rationale: > > 1. We should have `(eqv? z (make-rectangular (real-part z) (imag-part z))= )`. > > 2. The number `1.0` is exactly on the real number line, not=20 > approximately on the real number line. This behavior is important for=20 > some numeric code near the branch cuts of functions. > > 3. `(eqv? 1.0 1.0+0.0i)` is #f, so the numbers should be non-`eqv?` in=20 > one of their parts. > > I do not believe this is required by the R5RS/R7RS, but it is allowed=20 > and is useful. Makes sense. I'll submit a patch to chicken-hackers. Thanks for the suggestion. cheers, felix