本文整理匯總了C#中BigInteger.DivideByTwo方法的典型用法代碼示例。如果您正苦於以下問題:C# BigInteger.DivideByTwo方法的具體用法?C# BigInteger.DivideByTwo怎麽用?C# BigInteger.DivideByTwo使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類BigInteger
的用法示例。
在下文中一共展示了BigInteger.DivideByTwo方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: DividesSomeBigIntegersByTwo
public void DividesSomeBigIntegersByTwo()
{
var a = new BigInteger("32149817470458794114082");
var b = new BigInteger("912837407413498340938495840576282048");
Assert.AreEqual(new BigInteger("16074908735229397057041"), a.DivideByTwo());
Assert.AreEqual(new BigInteger("456418703706749170469247920288141024"), b.DivideByTwo());
}
示例2: DividesPowersOfTwoByTwo
public void DividesPowersOfTwoByTwo()
{
var a = new BigInteger(32);
var b = new BigInteger(16);
var c = new BigInteger(8);
var d = new BigInteger(4);
var e = new BigInteger(2);
var f = new BigInteger(1);
Assert.AreEqual(b, a.DivideByTwo());
Assert.AreEqual(c, b.DivideByTwo());
Assert.AreEqual(d, c.DivideByTwo());
Assert.AreEqual(e, d.DivideByTwo());
Assert.AreEqual(f, e.DivideByTwo());
}
示例3: DividesSomeIntegersByTwo
public void DividesSomeIntegersByTwo()
{
var a = new BigInteger(2212);
var b = new BigInteger(1106);
var c = new BigInteger(553);
Assert.AreEqual(b, a.DivideByTwo());
Assert.AreEqual(c, b.DivideByTwo());
}