# Re: [Scheme-reports] Strong win later reversed: Real numbers have imaginary part #e0

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

> 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.

In that case, the bug is in 'make-rectangular'.

> The standard is silent on whether or not this is allowed
> for make-rectangular,

The R7RS-draft-8 states in the definition of '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 is
> only supported as a place holder and in the future will
> be removed in favor of not underflowing.

Okay.  IMO, it's unwise to allow inexacts to use unbounded amounts of
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

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
```