コード例 #1
0
ファイル: Processor.cs プロジェクト: Rishana125/calculator
        public void ResetProcess(Mode mode)
        {
            currentMode = mode;
            switch (mode)
            {
            case Mode.PNumber:
                leftNumber  = new PNumber();
                rightNumber = new PNumber();
                break;

            case Mode.Fractional:
                leftNumber  = new FNumber();
                rightNumber = new FNumber();
                break;

            case Mode.Complex:
                leftNumber  = new CNumber();
                rightNumber = new CNumber();
                break;

            default:
                throw new ArgumentOutOfRangeException(nameof(mode), mode, null);
            }
            operation = Operation.None;
            function  = Function.None;
        }
コード例 #2
0
ファイル: CNumber.cs プロジェクト: Rishana125/calculator
        public override Number Inverse()
        {
            var res = new CNumber(1, 0).Divide(this);

            real      = (res as CNumber)?.real;
            imaginary = (res as CNumber)?.imaginary;
            return(this);
        }
コード例 #3
0
        public void Reset(Processor.Mode mode)
        {
            memoryState = State.Off;
            switch (mode)
            {
            case Processor.Mode.PNumber:
                number = new PNumber();
                break;

            case Processor.Mode.Fractional:
                number = new FNumber();
                break;

            case Processor.Mode.Complex:
                number = new CNumber();
                break;

            default:
                throw new ArgumentOutOfRangeException(nameof(mode), mode, null);
            }
        }