예제 #1
0
 public void ResetProcessor()
 {
     OperationReset();
     FunctionReset();
     Lop_Res.Reset();
     Rop.Reset();
 }
예제 #2
0
파일: Control.cs 프로젝트: Hexet/Calculator
 public string Clear()
 {
     processor.ResetProcessor();
     SetInitialStateCalculator();
     number.Reset();
     clear = false;
     return(editor.Clear());
 }
예제 #3
0
        public TPNumber ConvertBaseTo10(int p1, string strnum)
        {
            int      mod, k = 0, flag_sym = 0, check_num = 0;
            TPNumber numres = new TPNumber(0, p1);

            if (strnum == "0")
            {
                return(numres);
            }
            double num = 0;

            if (p1 == 10)
            {
                IFormatProvider formatter = new NumberFormatInfo {
                    NumberDecimalSeparator = "."
                };
                numres.number = double.Parse(strnum, formatter);
                return(numres);
            }
            int i = 0, count = 0;

            if (strnum[0] == '-')
            {
                flag_sym = 1;
                strnum   = strnum.Remove(0, 1);
            }
            strnum = strnum.Replace(',', '.');

            while (i < strnum.Length)
            {
                if (strnum[i] == '.')
                {
                    count = strnum.Length - i - 1;

                    break;
                }
                i++;
            }

            k = -count;

            check_num = checkNumBase(p1, strnum);

            if (strnum[0] == '0' && strnum[1] != '.')
            {
                check_num = 0;
            }


            if (check_num == 1)
            {
                for (int j = strnum.Length - 1; j >= 0; j--)
                {
                    if (strnum[j] >= '0' && strnum[j] <= '9')
                    {
                        num            = strnum[j] - '0';
                        numres.number += num * Math.Pow(p1, k);
                        k++;
                    }
                    else
                    if (strnum[j] >= 'A' && strnum[j] <= 'F')
                    {
                        num            = strnum[j] - 55;
                        numres.number += num * Math.Pow(p1, k);
                        k++;
                    }
                }

                if (flag_sym == 1)
                {
                    numres.number *= -1;
                }
                return(numres);
            }
            else
            {
                return(numres.Reset());
            }
        }
예제 #4
0
파일: Memory.cs 프로젝트: Hexet/Calculator
 public void Clear(TPNumber E)
 {
     FNumber.Reset();
     FNumber.systemBase = E.systemBase;
     FState             = MState._Off;
 }