Esempio n. 1
0
        /// <summary>
        /// Finds new display based on previous operator
        /// </summary>
        public void Equals()
        {
            if (numBase != "dec")
            {
                Entry    = ProgrammerFunctions.ConvertBase(Entry, numBase, "dec");
                PreEntry = ProgrammerFunctions.ConvertBase(PreEntry, preEntryBase, "dec");
            }

            if (operation == "+")
            {
                Entry = StandardFunctions.Add(PreEntry, Entry);
            }
            else if (operation == "-")
            {
                Entry = StandardFunctions.Subtract(PreEntry, Entry);
            }
            else if (operation == "*")
            {
                Entry = StandardFunctions.Multiply(PreEntry, Entry);
            }
            else if (operation == "/")
            {
                Entry = StandardFunctions.Divide(PreEntry, Entry);
            }
            else if (operation == "exp")
            {
                Entry = ScientificFunctions.GenericExponent(PreEntry, Entry);
            }
            else if (operation == "root")
            {
                Entry = ScientificFunctions.GenericRoot(PreEntry, Entry);
            }
            else if (operation == "log")
            {
                Entry = ScientificFunctions.GenericLog(PreEntry, Entry);
            }
            else if (operation == "power")
            {
                Entry = ScientificFunctions.ScientificNotation(Entry);
            }
            else if (operation == "i")
            {
                Entry = StandardFunctions.IntegerDivide(PreEntry, Entry);
            }
            else if (operation == "mod")
            {
                Entry = StandardFunctions.Mod(PreEntry, Entry);
            }

            PreEntry = Entry;

            if (numBase != "dec")
            {
                Entry    = ProgrammerFunctions.ConvertBase(Entry, "dec", numBase);
                PreEntry = ProgrammerFunctions.ConvertBase(PreEntry, "dec", numBase);
            }

            first      = true;
            overwrite  = true;
            operation  = "";
            enteredNum = false;
        }