当前位置: 首页>>代码示例>>C#>>正文


C# BigInteger.multiply方法代码示例

本文整理汇总了C#中BigInteger.multiply方法的典型用法代码示例。如果您正苦于以下问题:C# BigInteger.multiply方法的具体用法?C# BigInteger.multiply怎么用?C# BigInteger.multiply使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在BigInteger的用法示例。


在下文中一共展示了BigInteger.multiply方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: multiplyByTenPow

 /**
  * Multiplies a number by a power of ten.
  * This method is used in {@code BigDecimal} class.
  * @param val the number to be multiplied
  * @param exp a positive {@code long} exponent
  * @return {@code val * 10<sup>exp</sup>}
  */
 internal static BigInteger multiplyByTenPow(BigInteger val, long exp)
 {
     // PRE: exp >= 0
     return ((exp < tenPows.Length)
     ? multiplyByPositiveInt(val, tenPows[(int)exp])
     : val.multiply(powerOf10(exp)));
 }
开发者ID:sailesh341,项目名称:JavApi,代码行数:14,代码来源:Multiplication.cs

示例2: modPow2Inverse

        /**
         * @param x an odd positive number.
         * @param n the exponent by which 2 is raised.
         * @return {@code x<sup>-1</sup> (mod 2<sup>n</sup>)}.
         */
        internal static BigInteger modPow2Inverse(BigInteger x, int n)
        {
            // PRE: (x > 0), (x is odd), and (n > 0)
            BigInteger y = new BigInteger(1, new int[1 << n]);
            y.numberLength = 1;
            y.digits[0] = 1;
            y.sign = 1;

            for (int i = 1; i < n; i++) {
                if (BitLevel.testBit(x.multiply(y), i)) {
                    // Adding 2^i to y (setting the i-th bit)
                    y.digits[i >> 5] |= (1 << (i & 31));
                }
            }
            return y;
        }
开发者ID:sailesh341,项目名称:JavApi,代码行数:21,代码来源:Division.cs

示例3: multiplyByFivePow

 /**
  * Multiplies a number by a power of five.
  * This method is used in {@code BigDecimal} class.
  * @param val the number to be multiplied
  * @param exp a positive {@code int} exponent
  * @return {@code val * 5<sup>exp</sup>}
  */
 internal static BigInteger multiplyByFivePow(BigInteger val, int exp)
 {
     // PRE: exp >= 0
     if (exp < fivePows.Length) {
         return multiplyByPositiveInt(val, fivePows[exp]);
     } else if (exp < bigFivePows.Length) {
         return val.multiply(bigFivePows[exp]);
     } else {// Large powers of five
         return val.multiply(bigFivePows[1].pow(exp));
     }
 }
开发者ID:sailesh341,项目名称:JavApi,代码行数:18,代码来源:Multiplication.cs


注:本文中的BigInteger.multiply方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。