Exemplo n.º 1
0
 static object Expt10(int tnum)
 {
     if (tnum < 0)
     {
         return(new Fraction(1, BigInteger.Pow(10, (uint)-tnum)));
     }
     return(BigInteger.Pow(TEN, (uint)tnum));
 }
Exemplo n.º 2
0
        /// <summary>
        /// Multiply a BigInteger by the given power of ten.
        /// </summary>
        /// <param name="number">The BigInteger to multiply by a power of ten and replace with the product</param>
        /// <param name="power">The power of ten to multiply it by</param>
        private static void MultiplyByPowerOfTen(ref BigInteger number, uint power)
        {
            var powerOfTen = BigInteger.Pow(BigTen, power);

            number = number * powerOfTen;
        }
Exemplo n.º 3
0
        /// <summary>
        /// Multiply a BigInteger by the given power of two.
        /// </summary>
        /// <param name="number">The BigInteger to multiply by a power of two and replace with the product</param>
        /// <param name="shift">The power of two to multiply it by</param>
        private static void ShiftLeft(ref BigInteger number, uint shift)
        {
            var powerOfTwo = BigInteger.Pow(BigTwo, shift);

            number = number * powerOfTwo;
        }