Пример #1
0
        /// <summary>
        /// Gets math calculation of sub operations
        /// </summary>
        /// <param name="i">Number</param>
        /// <param name="sub">Type of sub operation</param>
        /// <returns>Result of calculation</returns>
        private static double SubOperation(double i, Operation.SubOperations sub)
        {
            switch (sub)
            {
            case Operation.SubOperations.Sin:
                return(Math.Sin(i));

            case Operation.SubOperations.Cos:
                return(Math.Cos(i));

            case Operation.SubOperations.Tg:
                return(Math.Tan(i));

            case Operation.SubOperations.Ctg:
                return(1f / Math.Tan(i));

            case Operation.SubOperations.Pow:
                return(Math.Pow(i, 2));

            case Operation.SubOperations.Sqrt:
                return(Math.Sqrt(i));

            default: return(i);
            }
        }
Пример #2
0
 private void AddSubOp(Operation.SubOperations sub)
 {
     if (top.Type == Operation.TypeOfOperation.NULL)
     {
         top.FirstSub = sub;
     }
     else
     {
         top.SecondSub = sub;
     }
 }