/// <summary> /// Calculates unary expressions and pushes the result into the operands stack /// </summary> /// <param name="op">Unary operator</param> /// <param name="operand">Operand</param> private void Calculate(string op, PrimesBigInteger operand) { PrimesBigInteger res = PrimesBigInteger.One; try { switch (op) { case Token.UnaryMinus: res = operand.Multiply(PrimesBigInteger.NegativeOne); break; //case Token.Abs: res = Math.Abs(operand); break; //case Token.ACosine: res = Math.Acos(operand); break; //case Token.ASine: res = Math.Asin(operand); break; //case Token.ATangent: res = Math.Atan(operand); break; //case Token.Cosine: res = Math.Cos(operand); break; //case Token.Ln: res = Math.Log(operand); break; //case Token.Log10: res = Math.Log10(operand); break; //case Token.Sine: res = Math.Sin(operand); break; case Token.Sqrt: res = operand.SquareRoot(); break; //case Token.Tangent: res = Math.Tan(operand); break; //case Token.Exp: res = Math.Exp(operand); break; //case Token.Factorial: for (int i = 2; i <= (int)operand; res *= i++) ; //break; } operands.Push(PostProcess(res)); } catch (Exception e) { ThrowException(e.Message); } }