本文整理汇总了C#中IBigInteger.ShiftLeft方法的典型用法代码示例。如果您正苦于以下问题:C# IBigInteger.ShiftLeft方法的具体用法?C# IBigInteger.ShiftLeft怎么用?C# IBigInteger.ShiftLeft使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IBigInteger
的用法示例。
在下文中一共展示了IBigInteger.ShiftLeft方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetInstance
/**
* Returns a <code>SimpleBigDecimal</code> representing the same numerical
* value as <code>value</code>.
* @param value The value of the <code>SimpleBigDecimal</code> to be
* created.
* @param scale The scale of the <code>SimpleBigDecimal</code> to be
* created.
* @return The such created <code>SimpleBigDecimal</code>.
*/
public static SimpleBigDecimal GetInstance(IBigInteger val, int scale)
{
return new SimpleBigDecimal(val.ShiftLeft(scale), scale);
}
示例2: Subtract
public SimpleBigDecimal Subtract(IBigInteger b)
{
return new SimpleBigDecimal(bigInt.Subtract(b.ShiftLeft(scale)), scale);
}
示例3: Add
public SimpleBigDecimal Add(IBigInteger b)
{
return new SimpleBigDecimal(bigInt.Add(b.ShiftLeft(scale)), scale);
}
示例4: CompareTo
public int CompareTo(IBigInteger val)
{
return bigInt.CompareTo(val.ShiftLeft(scale));
}
示例5: Multiply
public IBigInteger Multiply(
IBigInteger val)
{
if (SignValue == 0 || val.SignValue == 0)
return Zero;
if (val.QuickPow2Check()) // val is power of two
{
IBigInteger result = this.ShiftLeft(val.Abs().BitLength - 1);
return val.SignValue > 0 ? result : result.Negate();
}
if (this.QuickPow2Check()) // this is power of two
{
IBigInteger result = val.ShiftLeft(this.Abs().BitLength - 1);
return this.SignValue > 0 ? result : result.Negate();
}
int resLength = (this.BitLength + val.BitLength)/BitsPerInt + 1;
var res = new int[resLength];
if (val == this)
{
Square(res, this.Magnitude);
}
else
{
Multiply(res, this.Magnitude, val.Magnitude);
}
return new BigInteger(SignValue*val.SignValue, res, true);
}