本文整理汇总了C#中Org.BouncyCastle.Math.BigInteger.Pow方法的典型用法代码示例。如果您正苦于以下问题:C# BigInteger.Pow方法的具体用法?C# BigInteger.Pow怎么用?C# BigInteger.Pow使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Org.BouncyCastle.Math.BigInteger
的用法示例。
在下文中一共展示了BigInteger.Pow方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: BigInteger
static BigInteger()
{
Zero = new BigInteger(0, ZeroMagnitude, false);
Zero.nBits = 0; Zero.nBitLength = 0;
SMALL_CONSTANTS[0] = Zero;
for (uint i = 1; i < SMALL_CONSTANTS.Length; ++i)
{
SMALL_CONSTANTS[i] = CreateUValueOf(i);
}
One = SMALL_CONSTANTS[1];
Two = SMALL_CONSTANTS[2];
Three = SMALL_CONSTANTS[3];
Ten = SMALL_CONSTANTS[10];
radix2 = ValueOf(2);
radix2E = radix2.Pow(chunk2);
radix8 = ValueOf(8);
radix8E = radix8.Pow(chunk8);
radix10 = ValueOf(10);
radix10E = radix10.Pow(chunk10);
radix16 = ValueOf(16);
radix16E = radix16.Pow(chunk16);
primeProducts = new int[primeLists.Length];
for (int i = 0; i < primeLists.Length; ++i)
{
int[] primeList = primeLists[i];
int product = primeList[0];
for (int j = 1; j < primeList.Length; ++j)
{
product *= primeList[j];
}
primeProducts[i] = product;
}
}
示例2: TestPow
public void TestPow()
{
Assert.AreEqual(one, zero.Pow(0));
Assert.AreEqual(zero, zero.Pow(123));
Assert.AreEqual(one, one.Pow(0));
Assert.AreEqual(one, one.Pow(123));
BigInteger n = new BigInteger("1234567890987654321");
BigInteger result = one;
for (int i = 0; i < 10; ++i)
{
try
{
val(i).Pow(-1);
Assert.Fail("expected ArithmeticException");
}
catch (ArithmeticException) {}
Assert.AreEqual(result, n.Pow(i));
result = result.Multiply(n);
}
}