예제 #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;
 }