public BigInteger Pow(int exp)
{
if (exp < 0)
{
throw new ArithmeticException("Negative exponent");
}
if (exp == 0)
{
return One;
}
if (sign == 0 || Equals(One))
{
return this;
}
BigInteger y = One;
BigInteger z = this;
for (;;)
{
if ((exp & 0x1) == 1)
{
y = y.Multiply(z);
}
exp >>= 1;
if (exp == 0) break;
z = z.Multiply(z);
}
return y;
}