guile-devel
[Top][All Lists]
Advanced

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

Re: fix for expt bug


From: Ramakrishnan Muthukrishnan
Subject: Re: fix for expt bug
Date: Mon, 1 Nov 2010 09:33:27 +0530

On Mon, Nov 1, 2010 at 5:33 AM, Mark H Weaver <address@hidden> wrote:
> Ramakrishnan,
>
> Your fix is incorrect.  You have assumed that (-a)^b = -(a^b),

Mark,

Yes, you are right. Not sure what I was thinking when I made the patch. :-(

> The reported bug is simply due to roundoff error.  You must know
> something about complex numbers and specifically complex exponentials to
> understand what's happening here.  The spurious imaginary part is
> actually quite miniscule compared with the real part.  If one looks at
> these results in polar form, the complex argument (angle) should ideally
> be an exact zero, but is instead an inexact number very close to 0
> (about 2.45e-16 radians in this case).
>
> The most straightforward solution to this bug is to support a few
> special cases, such as:
>
>  (-a)^b = -(a^b)   (where a is positive real and b is an odd integer)
>  (-a)^b =   a^b    (where a is positive real and b is an even integer)

Thanks. I will take a dig at doing this solution.

-- 
  Ramakrishnan



reply via email to

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