本文整理汇总了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());
}