On 2 May 2011 00:28, Vincent Manis
<vmanis@x> wrote:
On 2011-05-01, at 06:58, Aaron W. Hsu wrote:
> WRITE and NUMBER->STRING should both do this. Both are required to produce
> the external representation of a number. If a number is polar, then it's
> external representation is in the real@real notation, and you will get
> that form.
I don't understand this. Polar and rectangular are external representations, are they not? Does a Scheme implementation have to flag complex numbers by their representation?
Whilst it doesn't have to, an implementation might want to for exactness purposes. There's a lot of implementation-specific leeway in what they can provide in that area, but both 3@4 and #e3@4 are exact and that property is lost when converting to rectangular representation. Of course, it's an extremely minor point, since there aren't many arithmetical operations you can do with polar forms that preserve exactness.and most of the time a real-world app will be using multiples of pi for the angle argument, leading immediately into inexact land.
End of the day, though, this is all pretty minor. Even without polar forms in the base language, we wouldn't be too deprived. So stuff like that feels a bit academic to me providing whatever is in the spec is, well, clearly specified.
Malcolm