示例#1
0
        /// <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);
        }
示例#2
0
        /// <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;
        }
示例#3
0
        /// <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);
        }
示例#4
0
        /// <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);
        }
示例#5
0
        /// <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);
        }
示例#6
0
 /// <summary>
 /// コピーコンストラクタ
 /// </summary>
 /// <param name="pSrc">コピー元</param>
 public CalculatorValue(CalculatorValue pSrc)
 {
     this.val = pSrc.val;
 }