[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

*To*: John Cowan <cowan@x>*Subject*: Re: [Scheme-reports] Strong win later reversed: Real numbers have imaginary part #e0*From*: Mark H Weaver <mhw@x>*Date*: Fri, 21 Dec 2012 14:24:52 -0500*Cc*: scheme-reports <scheme-reports@x>*In-reply-to*: <20121221161648.GB6196@mercury.ccil.org> (John Cowan's message of "Fri, 21 Dec 2012 11:16:48 -0500")*References*: <87bodu4r0r.fsf@tines.lan> <20121216041031.GE10312@mercury.ccil.org> <87pq25yh5s.fsf@tines.lan> <20121219221955.GH4477@mercury.ccil.org> <87d2y5y6fb.fsf@tines.lan> <20121221055315.GB28661@mercury.ccil.org> <87y5grsrvm.fsf@tines.lan> <CAOLEvS0hcjUBkwZnYSf6oZhqLSrKChm0Gc4bv_WkWk+XTSO4hQ@mail.gmail.com> <87mwx7smo3.fsf@tines.lan> <CAOLEvS0Pa0bYSDBrdkCy5TZkVpx_QvLMLgEFJ=LB+3=+GGTF1g@mail.gmail.com> <20121221161648.GB6196@mercury.ccil.org>

John Cowan <cowan@x> writes: > leppie scripsit: > >> > R6RS and R7RS-draft-8 require that (eqv? +0.0 -0.0) => #f >> >> R6RS says eqv? should behave like =. > > Actually not. For one thing, 2.0 and 2 have been different in > the sense of `eqv?` ever since R3RS. Since R2RS actually, if one pays attention to "will return #!false" language in the first sentences of the definition instead of the "Generally speaking ... should be used" language near the bottom. In the presence of the exact/inexact distinction, those two parts of the definition contradict each other, so it is impossible to satisfy them both. We must choose. I'm not sure why anyone would choose to ignore the clearly stated (and fully general) requirements in the first two sentences in favor of the "Generally speaking ... should be used" language near the bottom. > But what's relevant here is all that blibberty-blibber in the R6RS > definition of `eqv?` about being indistinguishable by any finite > composition of Scheme's standard arithmetic procedures. In particular, > (/ 0.0) is +inf.0, and (/ -0.0) is -inf.0, so they are obviously > distinguishable, and `eqv?` must not treat them as the same. Indeed, thanks for pointing this out! > As long as > your inexact reals are IEEE binaries, you can just distinguish this one > case and then fall back to =. Not quite. One must handle cases such as (eqv? 1+0.0i 1-0.0i) => #f. Also, if multiple precisions are supported (e.g. singles/doubles), and if the result of any standard arithmetic procedure depends on the precision of its operands, then 'eqv?' must distinguish numbers based on precision as well. For example, if (sqrt 2.0d1) returns a more precise answer than (sqrt 2.0s1), then (eqv? 2.0d1 2.0s1) must return #f. Regards, Mark _______________________________________________ Scheme-reports mailing list Scheme-reports@x http://lists.scheme-reports.org/cgi-bin/mailman/listinfo/scheme-reports

**Follow-Ups**:**Re: [Scheme-reports] Strong win later reversed: Real numbers have imaginary part #e0***From:*John Cowan <cowan@x>

**References**:**Re: [Scheme-reports] Strong win later reversed: Real numbers have imaginary part #e0***From:*Mark H Weaver <mhw@x>

**Re: [Scheme-reports] Strong win later reversed: Real numbers have imaginary part #e0***From:*John Cowan <cowan@x>

**Re: [Scheme-reports] Strong win later reversed: Real numbers have imaginary part #e0***From:*Mark H Weaver <mhw@x>

**Re: [Scheme-reports] Strong win later reversed: Real numbers have imaginary part #e0***From:*John Cowan <cowan@x>

**Re: [Scheme-reports] Strong win later reversed: Real numbers have imaginary part #e0***From:*Mark H Weaver <mhw@x>

**Re: [Scheme-reports] Strong win later reversed: Real numbers have imaginary part #e0***From:*John Cowan <cowan@x>

**Re: [Scheme-reports] Strong win later reversed: Real numbers have imaginary part #e0***From:*Mark H Weaver <mhw@x>

**Re: [Scheme-reports] Strong win later reversed: Real numbers have imaginary part #e0***From:*leppie <xacc.ide@x>

**Re: [Scheme-reports] Strong win later reversed: Real numbers have imaginary part #e0***From:*Mark H Weaver <mhw@x>

**Re: [Scheme-reports] Strong win later reversed: Real numbers have imaginary part #e0***From:*leppie <xacc.ide@x>

**Re: [Scheme-reports] Strong win later reversed: Real numbers have imaginary part #e0***From:*John Cowan <cowan@x>

- Prev by Date:
**Re: [Scheme-reports] Strong win later reversed: Real numbers have imaginary part #e0** - Next by Date:
**Re: [Scheme-reports] Strong win later reversed: Real numbers have imaginary part #e0** - Previous by thread:
**Re: [Scheme-reports] Strong win later reversed: Real numbers have imaginary part #e0** - Next by thread:
**Re: [Scheme-reports] Strong win later reversed: Real numbers have imaginary part #e0** - Index(es):