GNOME Bugzilla – Bug 627775
impower(-1,complex(0,1))
Last modified: 2010-08-23 23:20:41 UTC
impower(-1,complex(0,1)) evaluates to #DIV/0! Since impower(x,y) should be imexp(improduct(y,imln(x))) which is defined everywhere but for x = 0, this is surprising. Note that imexp(improduct(y,imln(x))) for x = -1 and y = complex(0,1) evaluates to 0.04321391826377 which is in fact the correct answer for impower(-1,complex(0,1)).
imln isn't well defined on the negative part of the real axis. (Or any other halfline from the origin that one might choose when defining imln.) That, of course, is not a good argument about what -1^i should be. I notice that we have both go_complex_pow and complex_pow.
Of course we can put the branch cut anywhere we like (and it would even need to be a straight halfline) . But there really isn't a reason not to cover the whole complex plane with the exception of the origin. I vote for having the branch cut of impower, imln and the other complex logarithms all in the same place.
Fixed. (Although I still need to move stuff over to goffice.) Note, that we went away from the exp-log formula for accuracy reasons a while ago. We get the branch cut from complex_angle, so things should be consistent.