[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Chicken-janitors] #1587: imag-part should return 0 instead of 0.0 o
From: |
Chicken Trac |
Subject: |
Re: [Chicken-janitors] #1587: imag-part should return 0 instead of 0.0 on a flonum |
Date: |
Thu, 28 Feb 2019 20:16:11 -0000 |
#1587: imag-part should return 0 instead of 0.0 on a flonum
---------------------------------------+-------------------
Reporter: johnwcowan | Owner:
Type: defect | Status: new
Priority: minor | Milestone: 5.1
Component: core libraries | Version: 5.0.0
Resolution: | Keywords:
Estimated difficulty: trivial |
---------------------------------------+-------------------
Comment (by sjamaan):
I just checked; CHICKEN is internally consistent given that the reader
converts `1.0+0.0i` into `1.0` (and constructing a cplxnum using `make-
rectangular` will return a plain flonum if the imag part is 0.0). Gauche
and Scheme48 agree on this, but Racket and MIT Scheme do not even though
they too do not support complex numbers of mixed exactness.
Both Racket and MIT Scheme return exact zero for `(imag-part 1.0)`.
However, they will keep `1.0+0.0i` as such, perhaps to make sure the
behaviour is internally consistent?
For those Schemes with mixed exactness complex numbers, it makes more
sense to return exact zero for a flonum's imag-part. For a Scheme that
supports only fully inexact or fully exact complex numbers, IMO it makes
less sense to return exact zero for an inexact number.
--
Ticket URL: <https://bugs.call-cc.org/ticket/1587#comment:3>
CHICKEN Scheme <https://www.call-cc.org/>
CHICKEN Scheme is a compiler for the Scheme programming language.