Esempio n. 1
0
        public override void execute(MK52_Host components, string command)
        {
            RPN_Stack s = _dealWithClergy1(components);

            if (s == null)
            {
                return;
            }
            s.storeBx();
            UniversalValue X = s.X;

            if (X.isInt())
            {
                return;
            }
            double result = X.toReal();

            if (result < 0)
            {
                result = -Math.Floor(-result);
            }
            else
            {
                result = Math.Floor(result);
            }
            X.fromReal(result);
        }
Esempio n. 2
0
        public override void execute(MK52_Host components, string command)
        {
            RPN_Stack s = _dealWithClergy1(components);

            if (s == null)
            {
                return;
            }
            s.storeBx();
            UniversalValue X = s.X;

            if (X.isInt())
            {
                X.fromInt(0);
                return;
            }
            double result   = X.toReal();
            bool   positive = true;

            if (result < 0)
            {
                result   = -result;
                positive = false;
            }
            result = result - Math.Floor(result);
            X.fromReal(positive ? result : -result);
        }
Esempio n. 3
0
        private void _autoIncrement(int n, UniversalValue uv)
        {
            if (n < 0)
            {
                return;
            }
            if (n > 6)
            {
                return;
            }
            int delta = (n > 3) ? 1 : -1;

            if (uv.isInt())
            {
                uv.fromInt(uv.toInt() + delta);
                return;
            }
            if (uv.isReal())
            {
                // TODO: For compatibility, registers are converted to int!
                // Not sure, if this must be supported or changed
                //uv.fromReal(uv.toReal() + (double)delta);
                uv.fromInt(uv.toInt() + delta);
                return;
            }
        }