Postby **phlip** » Sun Feb 27, 2011 5:17 am UTC

When you're dealing with complex numbers, then exponentiation gets kinda weird. A complex number to an integer power is fine, as is a positive real number to a complex power... but a negative or complex number to a fractional or even complex power is kinda complicated. In particular, you don't necessarily have a single answer. In the reals, when you talk about "the square root of x", there are two possibilities... one positive and one negative... but you can say "always take the positive one as the 'principal' square root" and be done with it... in complex numbers it's not so easy, there isn't an obvious "principal" root any more, at least not one that stays consistent and plays nice with the various identities we've come to know and love. There are two options - either pick a "principal" branch and stick with it, but have to throw out many of the nice identities, or keep the identities, but make logs and complex exponentiation multi-valued.

If you're going the former option, then a^(bc) = (a^b)^c is no longer necessarily true. If you go the latter option, then (-1)^(2/3) could be any of 1, -1/2 + sqrt(3)/2 i, or -1/2 - sqrt(3)/2 i.

Code: Select all

`enum ಠ_ಠ {°□°╰=1, °Д°╰, ಠ益ಠ╰};`

void ┻━┻︵╰(ಠ_ಠ ⚠) {exit((int)⚠);}

[he/him/his]