Exemple #1
0
        public void ExecuteFunction(double value, IStack stack)
        {
            var initialValue = stack.CurrentValue;

            stack.SetCurrentValue(Math.Pow(stack.CurrentValue, value));
            stack.AddExpression(ExpressionBuilder.BuildExpression(initialValue, value, Operand, FunctionIdentifier), stack.CurrentValue);
        }
Exemple #2
0
 public void ExecuteFunction(double value, IStack stack)
 {
     if (value == 0)
     {
         stack.Exception = @"Divide by Zero error";
     }
     else
     {
         var initialValue = stack.CurrentValue;
         stack.SetCurrentValue(initialValue / value);
         stack.AddExpression(ExpressionBuilder.BuildExpression(initialValue, value, Operand, FunctionIdentifier), stack.CurrentValue);
     }
 }