Example #1
0
            public NumericValue Apply(NumericValue input)
            {
                NumericValue result;

                if (this.IntegerOperation != null &&
                    (input.ValueType == RpnValueType.Integer || input.ValueType == RpnValueType.Binary))
                {
                    double opResult = this.IntegerOperation(input.ToInteger());
                    result = new DoubleValue(opResult);
                }
                else if (this.DoubleOperation != null && input.ValueType != RpnValueType.Complex)
                {
                    double opResult = this.DoubleOperation(input.ToDouble());
                    result = new DoubleValue(opResult);
                }
                else
                {
                    Complex opResult = this.ComplexOperation(input.ToComplex());
                    result = new ComplexValue(opResult);
                }

                return(result);
            }