public static BigInteger Pow(BigInteger bigValue, int power){ if((bigValue)==null)throw new ArgumentNullException("bigValue"); if((power)<0)throw new ArgumentException("power"+" not greater or equal to "+"0"+" ("+Convert.ToString((power),System.Globalization.CultureInfo.InvariantCulture)+")"); return bigValue.pow(power); }
public static BigInteger Pow(BigInteger bigValue, BigInteger power){ if((bigValue)==null)throw new ArgumentNullException("bigValue"); if((power)==null)throw new ArgumentNullException("power"); if((power.Sign)<0)throw new ArgumentException("power.Sign"+" not greater or equal to "+"0"+" ("+Convert.ToString((power.Sign),System.Globalization.CultureInfo.InvariantCulture)+")"); BigInteger val=BigInteger.One; while(power.Sign>0){ BigInteger p=(power>(BigInteger)5000000) ? (BigInteger)5000000 : power; val*=bigValue.pow((int)p); power-=p; } return val; }