Currently the code to take the NaturalLogarithm of a Complex number is as follows :
public Complex NaturalLogarithm()
{
if(IsReal)
return new Complex(Math.Log(real), 0d);
return new Complex(0.5d * Math.Log(ModulusSquared), Argument);
}
The exception for IsReal makes this function fail for real negative numbers.
For example : the natural logarithm of -exp(1) should be 1 + i*PI . This is a complex number, so ofcourse the standard Math.Log(-exp(1)) fails, but the NaturalLogarithm() function in your complex class should not fail.
Why not just remove the "special case" ?