guile-devel
[Top][All Lists]
Advanced

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

Re: Effects of updated number fixes on parsing


From: Mark H Weaver
Subject: Re: Effects of updated number fixes on parsing
Date: Wed, 02 Feb 2011 23:01:56 -0500
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux)

Mike Gran <address@hidden> writes:
> One of the things that looks odd are the complex numbers in polar format
>
> address@hidden equals zero, for example.

If that we accept the R6RS's (admittedly dubious) claim that +nan.0 is a
real number, I think this is correct.

We can deduce that mag*e^(i*ang) is 0 when MAG is 0, as long as ANG is
real, because the complex exponential is known to be finite (and in fact
has unit magnitude).  The limit as ANG goes to infinity is 0 as well.

However, I think the following cases are probably incorrect:

 address@hidden            : 0.0 : 0.0
 address@hidden           : 0.0 : 0.0
 address@hidden           : 0.0 : 0.0
 address@hidden       : 0.0 : 0.0
 address@hidden       : 0.0 : 0.0
 address@hidden       : 0.0 : 0.0
 address@hidden       : 0.0 : 0.0

The #i prefix is apparently causing the _result_ of scm_make_polar to be
made inexact.  Instead, I think that the specified magnitude and angle
should be made inexact _before_ calling scm_make_polar.  That would
cause the magnitude to be inexact, and therefore all of these cases
above would become non-real complex numbers.

However, it would cause the last three to become +nan.0+nan.0i, as they
were before, but we can do better than that.  They should instead be
0.0+0.0i.  scm_make_polar should check for another case: if the
magnitude is an inexact zero and the angle is not an exact zero, the
result should be 0.0+0.0i.

Does this make sense?

    Mark



reply via email to

[Prev in Thread] Current Thread [Next in Thread]