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

*To*: Sascha Ziemann <ceving@x>*Subject*: Re: [Scheme-reports] Strong win later reversed: Real numbers have imaginary part #e0*From*: John Cowan <cowan@x>*Date*: Sat, 15 Dec 2012 11:06:50 -0500*Cc*: scheme-reports <scheme-reports@x>*In-reply-to*: <CAGUt3y55KEVFn=6_i9yRXR8w_e8Nk2tN7QGCF8rEhYTs2Xgrjw@mail.gmail.com>*References*: <8738zc9g2x.fsf@tines.lan> <CAMMPzYOKcOm+trYA0Fc+NtWfG00K0BM4hvghsxrr6L9wnCyhuQ@mail.gmail.com> <87d2yf80q3.fsf@tines.lan> <20121214223854.GX29857@mercury.ccil.org> <CAGUt3y55KEVFn=6_i9yRXR8w_e8Nk2tN7QGCF8rEhYTs2Xgrjw@mail.gmail.com>

Sascha Ziemann scripsit: > 2012/12/14 John Cowan <cowan@x>: > >> For example, this reversal means that (max 1.0+0.0i 1.0-0.0i) is > >> permitted, and the result is no longer uniquely determined. > >> What should the result be? > > > > I'd say it's correct to return either one, since they are =. > > Wolfram thinks it is neither the first nor the second: > > http://www.wolframalpha.com/input/?i=max+%281.0%2B0.0i%2C+1.0-0.0i%29 Wolfram, like Common Lisp, takes a structural view of complex numbers: a number is complex just in case it has an imaginary part. In Scheme, complex numbers subsume real ones, but the answers of different Scheme standards have varied when the imaginary part is an inexact zero. R5RS and R7RS say such a number is real, R6RS (and Pure, which shares Scheme's numeric tower) say it is not. A similar question is what to do when the inexact arguments of `max` have different precisions. In CL, there is a rule of precision contagion such that (max 0.0d0 0.0f0) must return 0.0d0. In Scheme there is no such rule (though it is required that when a number is converted from exact to inexact because the exact system can't represent it, it gets the highest available precision), and it seems to me that either 0.0d0 or 0.0f0 is a valid answer. Racket is one of the few Schemes that supports 32-bit floats, and it returns 0.0d0 (printed as 0.0) in this case. -- I marvel at the creature: so secret and John Cowan so sly as he is, to come sporting in the pool cowan@x before our very window. Does he think that http://www.ccil.org/~cowan Men sleep without watch all night? _______________________________________________ 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:*Sascha Ziemann <ceving@x>

**References**:**[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:*Alex Shinn <alexshinn@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:*Sascha Ziemann <ceving@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):