/// <summary> /// 演算 /// </summary> /// <param name="pStackValue">値スタック</param> public override void Calculation(ValueStack pStackValue) { CalculatorValue v1; CalculatorValue newValue = this.Get1Value(pStackValue, out v1); newValue.Value = Math.Truncate(v1.Value); }
/// <summary> /// 演算 /// </summary> /// <param name="pStackValue">値スタック</param> public override void Calculation(ValueStack pStackValue) { CalculatorValue v1; CalculatorValue newValue = this.Get1Value(pStackValue, out v1); newValue.Value = v1.Value * 180.0 / Math.PI; }
/// <summary> /// 演算 /// </summary> /// <param name="pStackValue">値スタック</param> public override void Calculation(ValueStack pStackValue) { CalculatorValue v1; CalculatorValue newValue = this.Get1Value(pStackValue, out v1); newValue.Value = Math.Round(v1.Value, MidpointRounding.AwayFromZero); }
/// <summary> /// 演算 /// </summary> /// <param name="pStackValue">値スタック</param> public override void Calculation(ValueStack pStackValue) { CalculatorValue v1, v2; CalculatorValue newValue = this.Get2Value(pStackValue, out v1, out v2); newValue.Value = Math.Pow(v1.Value, v2.Value); }
/// <summary> /// 1値取得 /// </summary> /// <param name="pValueStack">ValueStack</param> /// <param name="pValue1">値1</param> /// <returns>値1のコピー(pValueStackの先頭にpush済み)</returns> protected virtual CalculatorValue Get1Value(ValueStack pValueStack, out CalculatorValue pValue1) { pValue1 = pValueStack.Pop(); // pValue1破壊防止のため、身代わりのコピーを作ってスタックに積む CalculatorValue newValue = new CalculatorValue(pValue1); pValueStack.Push(newValue); return(newValue); }
/// <summary> /// コピーコンストラクタ /// </summary> /// <param name="pSrc">コピー元</param> public CalculatorValue(CalculatorValue pSrc) { this.val = pSrc.val; }