On Mon, Nov 1, 2010 at 5:33 AM, Mark H Weaver <[email protected]> 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
