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

*To*: Mark H Weaver <mhw@x>*Subject*: Re: [Scheme-reports] Strong win later reversed: Real numbers have imaginary part #e0*From*: Alex Shinn <alexshinn@x>*Date*: Sat, 22 Dec 2012 11:21:53 +0900*Cc*: John Cowan <cowan@x>, scheme-reports <scheme-reports@x>*In-reply-to*: <871uejrxv0.fsf@tines.lan>*References*: <878v8z5iq8.fsf@tines.lan> <874njn5b65.fsf@tines.lan> <20121215204015.GG13463@mercury.ccil.org> <87obhv3ts0.fsf@tines.lan> <20121215231548.GC10312@mercury.ccil.org> <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> <CAMMPzYMQVzkQFLsgcYAWZaFO__Y13T_kOXD+CrLqVXPQOcjXGw@mail.gmail.com> <871uejrxv0.fsf@tines.lan>

On Sat, Dec 22, 2012 at 4:47 AM, Mark H Weaver <mhw@x> wrote:

Alex Shinn <alexshinn@x> writes:In that case, the bug is in 'make-rectangular'.

> The result you're seeing is because make-rectangular

> is defined:

>

> (define (make-rectangular x y)

> (+ x (* y (sqrt -1))))

>

> in order to keep the number of primitives to a minimum,

> and the sign on the zero gets lost in the arithmetic.

The R7RS-draft-8 states in the definition of 'make-rectangular':

> The standard is silent on whether or not this is allowed

> for make-rectangular,

Then all of:

(make-rectangular x_1 x_2) => z

[...]

(real-part z) => x_1

(imag-part z) => x_2

[...]

are true, [...]

The notation => is "evaluates to" which is not guaranteed to be eqv?.

It does imply the written notation be the same, but we have to give

leeway with complex numbers because there's a much bigger problem

that this definition is inconsistent. For example if an implementation

supports only polar representations internally, then it is impossible in

general to guarantee that (real-part (make-rectangular x z)) returns a

value which is even = to x, much less eqv? or written the same.

Therefore Chibi's definition of make-rectangular is allowed.

> but note in Chibi the value -0.0 isOkay. IMO, it's unwise to allow inexacts to use unbounded amounts of

> only supported as a place holder and in the future will

> be removed in favor of not underflowing.

memory and computation time, and I could easily construct example

computations that work well on most implementations but that slow down

to a crawl and/or run out of memory in your proposed representation, but

Chibi is your baby and that's your choice.

Actually, my representation of choice is Conway's chained arrow notation

(and their reciprocals), which you would be unable to run out of memory

even running repeated exponentiations until the heat death of the universe.

This is a very, very approximate representation, but is of course

infinitely more accurate than just underflowing to 0.

--

Alex

_______________________________________________ Scheme-reports mailing list Scheme-reports@x http://lists.scheme-reports.org/cgi-bin/mailman/listinfo/scheme-reports

**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:*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:*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:*Alex Shinn <alexshinn@x>

**Re: [Scheme-reports] Strong win later reversed: Real numbers have imaginary part #e0***From:*Mark H Weaver <mhw@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):