public static int AsInt32(Complex c)
 {
     if (c.IsReal)
     {
         if (ExMath.IsInt32(c.Re))
         {
             return((int)c.Re);
         }
         throw ExceptionHelper.ThrowInvalidArgumentType("integer", "real");
     }
     throw ExceptionHelper.ThrowInvalidArgumentType("integer", "complex");
 }
 private Complex EvaluateComplexComplex(Complex left, Complex right)
 {
     if (right.IsReal)
     {
         if (ExMath.IsInt32(right.Re))
         {
             return(Complex.Pow((Complex)left, (int)right.Re));
         }
         else
         {
             return(Complex.Pow((Complex)left, right.Re));
         }
     }
     else
     {
         return(Complex.Pow((Complex)left, right));
     }
 }
 private CMatrix EvaluateCMatrixComplex(CMatrix left, Complex right)
 {
     if (left.IsVector)
     {
         return(CMatrix.Pow(left, right));
     }
     else if (left.IsSquare)
     {
         if (right.IsReal && ExMath.IsInt32(right.Re))
         {
             return(CMatrix.Pow(left, (int)right.Re));
         }
         else
         {
             throw new ArgumentException(Properties.Resources.EXC_MATRIX_NOT_INTEGER_POWER);
         }
     }
     else
     {
         throw new ArgumentException(Properties.Resources.EXC_MATRIX_MUST_BE_SQUARE_OR_VECTOR);
     }
 }