コード例 #1
0
        public void CalculatorTest(double firstValue, double expected)
        {
            var calculator   = new TenPower();
            var actualResult = calculator.Calculate(firstValue);

            Assert.AreEqual(expected, actualResult);
        }
コード例 #2
0
            public static TenPower GetInstance(int index)
            {
                TenPower result = _cache[index];

                if (result == null)
                {
                    result        = new TenPower(index);
                    _cache[index] = result;
                }
                return(result);
            }
コード例 #3
0
        public void multiplyByPowerOfTen(int pow10)
        {
            TenPower tp = TenPower.GetInstance(Math.Abs(pow10));

            if (pow10 < 0)
            {
                mulShift(tp._divisor, tp._divisorShift);
            }
            else
            {
                mulShift(tp._multiplicand, tp._multiplierShift);
            }
        }
コード例 #4
0
 public static TenPower GetInstance(int index)
 {
     TenPower result = _cache[index];
     if (result == null)
     {
         result = new TenPower(index);
         _cache[index] = result;
     }
     return result;
 }