/// <summary> /// Visits the given input data node. /// </summary> /// <param name="data">Input data node.</param> public override void PostVisit(InputData.PDDL.ObjectFunctionTerm data) { int functionNameId = IdManager.Functions.GetId(data.Name, data.Terms.Count); List <ITerm> argumentTerms = new List <ITerm>(); for (int i = 0; i < data.Terms.Count; ++i) { argumentTerms.Add(TermStack.Pop()); } TermStack.Push(new ObjectFunctionTerm(new Atom(functionNameId, argumentTerms), IdManager)); }
/// <summary> /// Visits expression term. /// </summary> /// <param name="term">Expression term.</param> public void PostVisit(ObjectFunctionTerm term) { List <int> argumentsList = new List <int>(); for (int i = 0; i < term.Terms.Count; ++i) { argumentsList.Add(TermStack.Pop()); } argumentsList.Reverse(); IGroundedAtom groundedFunctionAtom = new GroundedAtom(term.NameID, argumentsList); int groundedConstantValue = ReferenceState.GetObjectFunctionValue(groundedFunctionAtom); TermStack.Push(groundedConstantValue); }
/// <summary> /// Visits expression term. /// </summary> /// <param name="term">Expression term.</param> public void Visit(VariableTerm term) { TermStack.Push(Substitution.GetValue(term.NameID)); }
/// <summary> /// Visits expression term. /// </summary> /// <param name="term">Expression term.</param> public void Visit(ConstantTerm term) { TermStack.Push(term.NameID); }
/// <summary> /// Visits the given input data node. /// </summary> /// <param name="data">Input data node.</param> public override void Visit(InputData.PDDL.VariableTerm data) { int variableNameId = IdManager.Variables.GetId(data.Name); TermStack.Push(new VariableTerm(variableNameId)); }
/// <summary> /// Visits the given input data node. /// </summary> /// <param name="data">Input data node.</param> public override void Visit(InputData.PDDL.ConstantTerm data) { int constantNameId = IdManager.Constants.GetId(data.Name); TermStack.Push(new ConstantTerm(constantNameId, IdManager)); }
public void getTermFromString(string input, ref TermStack TStack, ref int startPositionPointer) { //Console.Write("start term {0}, ", input[startPositionPointer]); TermTypes tt; TermAbsClass term = null; bool isOK_Flag = false; int tmp = startPositionPointer; //string txt=TakePieceFromText(input,startPosition,input.Length-startPosition-1); if (startPositionPointer < input.Length && OperatorSymbols.Contains(input[startPositionPointer]) && !isOK_Flag) //if is operator { //Console.WriteLine("operator {0}", input[startPositionPointer]); tt = TermTypes.OPR; startPositionPointer++; if (startPositionPointer < input.Length && OperatorSymbols.Contains(input[startPositionPointer])) { startPositionPointer++; } string txt = TakePieceFromText(input, tmp, startPositionPointer - tmp); term = OPRTerm.GetOperatorTerm(txt); //Console.Write("{0} is done from string ({1}),",OPRTerm.GetOperatorTerm(txt).GetOperatorType, txt); isOK_Flag = true; } if (startPositionPointer < input.Length && char.IsDigit(input[startPositionPointer]) && !isOK_Flag) //if a number { int len = 0; bool isFloat = false; while (startPositionPointer + len < input.Length && char.IsDigit(input[startPositionPointer + len])) { len++; } if (startPositionPointer + len < input.Length && len > 0 && input[startPositionPointer + len] == '.') { isFloat = true; len++; while (startPositionPointer + len < input.Length && char.IsDigit(input[startPositionPointer + len])) { len++; } } if (isFloat) { NumberFormatInfo provider = new NumberFormatInfo(); provider.CurrencyDecimalSeparator = "."; double x = Convert.ToDouble(TakePieceFromText(input, startPositionPointer, len), provider); term = new FLTTerm(x); //Console.Write("FLOAT {0}, ", x); } else { long x = Convert.ToInt64(TakePieceFromText(input, startPositionPointer, len)); term = new INTTerm(x); //Console.Write("INTEGER {0}, ", x); } isOK_Flag = true; startPositionPointer += len; } if (startPositionPointer < input.Length && char.IsLetter(input[startPositionPointer]) && !isOK_Flag) //FNC and VAR starts with letter { int len = 1; while (startPositionPointer + len < input.Length && char.IsLetter(input[startPositionPointer + len])) { len++; } if (startPositionPointer + len < input.Length && input[startPositionPointer + len] == '(') //if name is interupted with bracket - it's func { term = new FNCTerm(FNCType.ERROR); //todo catch function } else { uint[] debugPush = new uint[1]; //string txt=TakePieceFromText(input,startPosition,input.Length-startPosition-1); term = new VARTerm(VARType.ERR, debugPush); //todo catch variable } startPositionPointer += len; isOK_Flag = true; } if (startPositionPointer < input.Length && Markup.Contains(input[startPositionPointer]) && !isOK_Flag) { //Console.WriteLine("Markup!!"); term = new MRKTerm(Convert.ToString(input[startPositionPointer++])); isOK_Flag = true; } if (!isOK_Flag) { throw new ParsingException(input[startPositionPointer]); } TStack.Push(term); }
public static void PerformOperatorComputation(OPRTerm oper, TermStack TStack) { unchecked { switch (oper.GetOperatorType) { case OPRType.EQUAL: TermAbsClass B = TStack.Pop(); TermAbsClass A = TStack.Pop(); if (A.GetTermType == TermTypes.INT || A.GetTermType == TermTypes.FLT) //A is now totally B { TStack.Push(B); } if (A.GetTermType == TermTypes.VAR) //A is now variable with B value (can be variable, that contains variable) { VARTerm tmp; //(VARType)B.GetBitValue[0] gets variable type if (B.GetTermType == TermTypes.INT) { tmp = new VARTerm(VARType.INT, B.GetBitValue); } else if (B.GetTermType == TermTypes.FLT) { tmp = new VARTerm(VARType.FLT, B.GetBitValue); } else { throw new NotImplementedException(); } TStack.Push(tmp); } break; case OPRType.PLUS: B = TStack.Pop(); A = TStack.Pop(); if (A.GetTermType == TermTypes.INT) { long a = BytesToINT(A.GetBitValue); if (B.GetTermType == TermTypes.INT) { long b = BytesToINT(B.GetBitValue); TStack.Push(new INTTerm(a + b)); //Console.WriteLine("{0} is internal",TStack.Pop().debug_GetValueAsString()); //TStack.Push(new INTTerm(a+b)); } if (B.GetTermType == TermTypes.FLT) { double b = BytesToDBL(B.GetBitValue); TStack.Push(new FLTTerm(a + b)); } if (B.GetTermType == TermTypes.VAR) { throw new NotImplementedException(); } } if (A.GetTermType == TermTypes.FLT) { double a = BytesToDBL(A.GetBitValue); if (B.GetTermType == TermTypes.INT) { long b = BytesToINT(B.GetBitValue); TStack.Push(new FLTTerm(a + b)); } if (B.GetTermType == TermTypes.FLT) { double b = BytesToDBL(B.GetBitValue); TStack.Push(new FLTTerm(a + b)); } if (B.GetTermType == TermTypes.VAR) { throw new NotImplementedException(); } } if (A.GetTermType == TermTypes.VAR) { throw new NotImplementedException(); } break; case OPRType.MINUS: B = TStack.Pop(); //wtf(0_o) A = TStack.Pop(); if (A.GetTermType == TermTypes.VAR) { A = GetObjectFromVAR(A); } if (B.GetTermType == TermTypes.VAR) { B = GetObjectFromVAR(B); } if (A.GetTermType == TermTypes.INT) { long a = BytesToINT(A.GetBitValue); if (B.GetTermType == TermTypes.INT) { long b = BytesToINT(B.GetBitValue); TStack.Push(new INTTerm(a - b)); //Console.WriteLine("{0} is internal",TStack.Pop().debug_GetValueAsString()); //TStack.Push(new INTTerm(a+b)); } if (B.GetTermType == TermTypes.FLT) { double b = BytesToDBL(B.GetBitValue); TStack.Push(new FLTTerm(a - b)); } if (B.GetTermType == TermTypes.VAR) { throw new NotImplementedException(); } } if (A.GetTermType == TermTypes.FLT) { double a = BytesToDBL(A.GetBitValue); if (B.GetTermType == TermTypes.INT) { long b = BytesToINT(B.GetBitValue); TStack.Push(new FLTTerm(a - b)); } if (B.GetTermType == TermTypes.FLT) { double b = BytesToDBL(B.GetBitValue); TStack.Push(new FLTTerm(a - b)); } if (B.GetTermType == TermTypes.VAR) { throw new NotImplementedException(); } } break; case OPRType.MULT: B = TStack.Pop(); A = TStack.Pop(); if (A.GetTermType == TermTypes.VAR) { A = GetObjectFromVAR(A); } if (B.GetTermType == TermTypes.VAR) { B = GetObjectFromVAR(B); } if (A.GetTermType == TermTypes.INT) { long a = BytesToINT(A.GetBitValue); if (B.GetTermType == TermTypes.INT) { long b = BytesToINT(B.GetBitValue); TStack.Push(new INTTerm(a * b)); } if (B.GetTermType == TermTypes.FLT) { double b = BytesToDBL(B.GetBitValue); TStack.Push(new FLTTerm(a * b)); } } if (A.GetTermType == TermTypes.FLT) { double a = BytesToDBL(A.GetBitValue); if (B.GetTermType == TermTypes.INT) { long b = BytesToINT(B.GetBitValue); TStack.Push(new FLTTerm(a * b)); } if (B.GetTermType == TermTypes.FLT) { double b = BytesToDBL(B.GetBitValue); TStack.Push(new FLTTerm(a * b)); } } break; case OPRType.DIV: B = TStack.Pop(); A = TStack.Pop(); if (A.GetTermType == TermTypes.VAR) { A = GetObjectFromVAR(A); } if (B.GetTermType == TermTypes.VAR) { B = GetObjectFromVAR(B); } if (A.GetTermType == TermTypes.INT) { long a = BytesToINT(A.GetBitValue); if (B.GetTermType == TermTypes.INT) { long b = BytesToINT(B.GetBitValue); TStack.Push(new INTTerm(a / b)); //Console.WriteLine("{0} is internal",TStack.Pop().debug_GetValueAsString()); //TStack.Push(new INTTerm(a+b)); } if (B.GetTermType == TermTypes.FLT) { double b = BytesToDBL(B.GetBitValue); TStack.Push(new FLTTerm(a / b)); } } if (A.GetTermType == TermTypes.FLT) { double a = BytesToDBL(A.GetBitValue); if (B.GetTermType == TermTypes.INT) { long b = BytesToINT(B.GetBitValue); TStack.Push(new FLTTerm(a / b)); } if (B.GetTermType == TermTypes.FLT) { double b = BytesToDBL(B.GetBitValue); TStack.Push(new FLTTerm(a / b)); } if (B.GetTermType == TermTypes.VAR) { throw new NotImplementedException(); } } if (A.GetTermType == TermTypes.VAR) { throw new NotImplementedException(); } break; case OPRType.PERCENT: B = TStack.Pop(); A = TStack.Pop(); if (A.GetTermType == TermTypes.VAR) { A = GetObjectFromVAR(A); } if (B.GetTermType == TermTypes.VAR) { B = GetObjectFromVAR(B); } if (A.GetTermType == TermTypes.INT) { long a = BytesToINT(A.GetBitValue); if (B.GetTermType == TermTypes.INT) { long b = BytesToINT(B.GetBitValue); TStack.Push(new INTTerm(a % b)); //Console.WriteLine("{0} is internal",TStack.Pop().debug_GetValueAsString()); //TStack.Push(new INTTerm(a+b)); } if (B.GetTermType == TermTypes.FLT) { double b = BytesToDBL(B.GetBitValue); TStack.Push(new FLTTerm(a % (long)b)); } } if (A.GetTermType == TermTypes.FLT) { double a = BytesToDBL(A.GetBitValue); if (B.GetTermType == TermTypes.INT) { long b = BytesToINT(B.GetBitValue); TStack.Push(new FLTTerm((long)a / b)); } if (B.GetTermType == TermTypes.FLT) { double b = BytesToDBL(B.GetBitValue); TStack.Push(new FLTTerm((long)a / (long)b)); } } break; case OPRType.LESS: B = TStack.Pop(); A = TStack.Pop(); if (A.GetTermType == TermTypes.VAR) { A = GetObjectFromVAR(A); } if (B.GetTermType == TermTypes.VAR) { B = GetObjectFromVAR(B); } if (A.GetTermType == TermTypes.INT) { long a = BytesToINT(A.GetBitValue); if (B.GetTermType == TermTypes.INT) { long b = BytesToINT(B.GetBitValue); TStack.Push(new INTTerm(LogicNumber(a < b))); //Console.WriteLine("{0} is internal",TStack.Pop().debug_GetValueAsString()); //TStack.Push(new INTTerm(a+b)); } if (B.GetTermType == TermTypes.FLT) { double b = BytesToDBL(B.GetBitValue); TStack.Push(new INTTerm(LogicNumber(a < b))); } } if (A.GetTermType == TermTypes.FLT) { double a = BytesToDBL(A.GetBitValue); if (B.GetTermType == TermTypes.INT) { long b = BytesToINT(B.GetBitValue); TStack.Push(new INTTerm(LogicNumber(a < b))); } if (B.GetTermType == TermTypes.FLT) { double b = BytesToDBL(B.GetBitValue); TStack.Push(new INTTerm(LogicNumber(a < b))); } } break; case OPRType.MORE: B = TStack.Pop(); A = TStack.Pop(); if (A.GetTermType == TermTypes.VAR) { A = GetObjectFromVAR(A); } if (B.GetTermType == TermTypes.VAR) { B = GetObjectFromVAR(B); } if (A.GetTermType == TermTypes.INT) { long a = BytesToINT(A.GetBitValue); if (B.GetTermType == TermTypes.INT) { long b = BytesToINT(B.GetBitValue); TStack.Push(new INTTerm(LogicNumber(a > b))); } if (B.GetTermType == TermTypes.FLT) { double b = BytesToDBL(B.GetBitValue); TStack.Push(new INTTerm(LogicNumber(a > b))); } } if (A.GetTermType == TermTypes.FLT) { double a = BytesToDBL(A.GetBitValue); if (B.GetTermType == TermTypes.INT) { long b = BytesToINT(B.GetBitValue); TStack.Push(new INTTerm(LogicNumber(a > b))); } if (B.GetTermType == TermTypes.FLT) { double b = BytesToDBL(B.GetBitValue); TStack.Push(new INTTerm(LogicNumber(a > b))); } } break; case OPRType.EXL_MRK: //NOT A = TStack.Pop(); if (A.GetTermType == TermTypes.VAR) { A = GetObjectFromVAR(A); } if (A.GetTermType == TermTypes.INT) { long a = BytesToINT(A.GetBitValue); if (a > 0) { TStack.Push(new INTTerm(0)); } else { TStack.Push(new INTTerm(1)); } } if (A.GetTermType == TermTypes.FLT) { double a = BytesToDBL(A.GetBitValue); int round = (int)(a + flt_round_tolerancy); if (round > 0) { TStack.Push(new INTTerm(0)); } else { TStack.Push(new INTTerm(1)); } } break; case OPRType.AMPERSANT: //boolean and B = TStack.Pop(); A = TStack.Pop(); if (A.GetTermType == TermTypes.VAR) { A = GetObjectFromVAR(A); } if (B.GetTermType == TermTypes.VAR) { B = GetObjectFromVAR(B); } if (A.GetTermType == TermTypes.INT) { long a = BytesToINT(A.GetBitValue); if (B.GetTermType == TermTypes.INT) { long b = BytesToINT(B.GetBitValue); TStack.Push(new INTTerm(TransformToPseudoBool(a) & TransformToPseudoBool(b))); //a and b are "booleans" } if (B.GetTermType == TermTypes.FLT) { double b = BytesToDBL(B.GetBitValue); TStack.Push(new INTTerm(TransformToPseudoBool(a) & TransformToPseudoBool((long)(b + flt_round_tolerancy)))); } } if (A.GetTermType == TermTypes.FLT) { double a = BytesToDBL(A.GetBitValue); long tmp = (long)(a + flt_round_tolerancy); if (B.GetTermType == TermTypes.INT) { long b = BytesToINT(B.GetBitValue); TStack.Push(new INTTerm(TransformToPseudoBool(tmp) & TransformToPseudoBool(b))); } if (B.GetTermType == TermTypes.FLT) { double b = BytesToDBL(B.GetBitValue); long tmp1 = (long)(b + flt_round_tolerancy); TStack.Push(new INTTerm(TransformToPseudoBool(tmp) & TransformToPseudoBool(tmp1))); } } break; case OPRType.VERT_BAR: //OR B = TStack.Pop(); A = TStack.Pop(); if (A.GetTermType == TermTypes.VAR) { A = GetObjectFromVAR(A); } if (B.GetTermType == TermTypes.VAR) { B = GetObjectFromVAR(B); } if (A.GetTermType == TermTypes.INT) { long a = BytesToINT(A.GetBitValue); if (B.GetTermType == TermTypes.INT) { long b = BytesToINT(B.GetBitValue); TStack.Push(new INTTerm(TransformToPseudoBool(a) | TransformToPseudoBool(b))); //a and b are "booleans" //Console.WriteLine("{0} is internal",TStack.Pop().debug_GetValueAsString()); //TStack.Push(new INTTerm(a+b)); } if (B.GetTermType == TermTypes.FLT) { double b = BytesToDBL(B.GetBitValue); TStack.Push(new INTTerm(TransformToPseudoBool(a) | TransformToPseudoBool((long)(b + flt_round_tolerancy)))); } } if (A.GetTermType == TermTypes.FLT) { double a = BytesToDBL(A.GetBitValue); long tmp = (long)(a + flt_round_tolerancy); if (B.GetTermType == TermTypes.INT) { long b = BytesToINT(B.GetBitValue); TStack.Push(new INTTerm(TransformToPseudoBool(tmp) | TransformToPseudoBool(b))); } if (B.GetTermType == TermTypes.FLT) { double b = BytesToDBL(B.GetBitValue); long tmp1 = (long)(b + flt_round_tolerancy); TStack.Push(new INTTerm(TransformToPseudoBool(tmp) | TransformToPseudoBool(tmp1))); } } break; case OPRType.DBL_AMPERSANT: //bitwise AND B = TStack.Pop(); A = TStack.Pop(); if (A.GetTermType == TermTypes.VAR) { A = GetObjectFromVAR(A); } if (B.GetTermType == TermTypes.VAR) { B = GetObjectFromVAR(B); } if (A.GetTermType == TermTypes.INT) { long a = BytesToINT(A.GetBitValue); if (B.GetTermType == TermTypes.INT) { long b = BytesToINT(B.GetBitValue); TStack.Push(new INTTerm(a & b)); //a and b are "booleans" } if (B.GetTermType == TermTypes.FLT) { double b = BytesToDBL(B.GetBitValue); TStack.Push(new INTTerm(a & (long)(b + flt_round_tolerancy))); } } if (A.GetTermType == TermTypes.FLT) { double a = BytesToDBL(A.GetBitValue); long tmp = (long)(a + flt_round_tolerancy); if (B.GetTermType == TermTypes.INT) { long b = BytesToINT(B.GetBitValue); TStack.Push(new INTTerm(tmp & b)); } if (B.GetTermType == TermTypes.FLT) { double b = BytesToDBL(B.GetBitValue); long tmp1 = (long)(b + flt_round_tolerancy); TStack.Push(new INTTerm(tmp & tmp1)); } } break; case OPRType.DBL_VERT_BAR: //bitwise OR B = TStack.Pop(); A = TStack.Pop(); if (A.GetTermType == TermTypes.VAR) { A = GetObjectFromVAR(A); } if (B.GetTermType == TermTypes.VAR) { B = GetObjectFromVAR(B); } if (A.GetTermType == TermTypes.INT) { long a = BytesToINT(A.GetBitValue); if (B.GetTermType == TermTypes.INT) { long b = BytesToINT(B.GetBitValue); TStack.Push(new INTTerm(a | b)); //a and b are "booleans" } if (B.GetTermType == TermTypes.FLT) { double b = BytesToDBL(B.GetBitValue); TStack.Push(new INTTerm(a | (long)(b + flt_round_tolerancy))); } } if (A.GetTermType == TermTypes.FLT) { double a = BytesToDBL(A.GetBitValue); long tmp = (long)(a + flt_round_tolerancy); if (B.GetTermType == TermTypes.INT) { long b = BytesToINT(B.GetBitValue); TStack.Push(new INTTerm(tmp | b)); } if (B.GetTermType == TermTypes.FLT) { double b = BytesToDBL(B.GetBitValue); long tmp1 = (long)(b + flt_round_tolerancy); TStack.Push(new INTTerm(tmp | tmp1)); } } break; case OPRType.DBL_EXL_MRK: //bitwise NOT A = TStack.Pop(); if (A.GetTermType == TermTypes.VAR) { A = GetObjectFromVAR(A); } if (A.GetTermType == TermTypes.INT) { long a = BytesToINT(A.GetBitValue); TStack.Push(new INTTerm(~a)); //~ is inversion } if (A.GetTermType == TermTypes.FLT) { double a = BytesToDBL(A.GetBitValue); long tmp = (long)(a + flt_round_tolerancy); TStack.Push(new INTTerm(~tmp)); } break; case OPRType.INCREMENT: A = TStack.Pop(); if (A.GetTermType == TermTypes.VAR) { A = GetObjectFromVAR(A); } if (A.GetTermType == TermTypes.INT) { long a = BytesToINT(A.GetBitValue); TStack.Push(new INTTerm(++a)); //~ is inversion } if (A.GetTermType == TermTypes.FLT) { double a = BytesToDBL(A.GetBitValue); TStack.Push(new FLTTerm(a + flt_round_tolerancy)); } break; case OPRType.DECREMENT: A = TStack.Pop(); if (A.GetTermType == TermTypes.VAR) { A = GetObjectFromVAR(A); } if (A.GetTermType == TermTypes.INT) { long a = BytesToINT(A.GetBitValue); TStack.Push(new INTTerm(--a)); //~ is inversion } if (A.GetTermType == TermTypes.FLT) { double a = BytesToDBL(A.GetBitValue); TStack.Push(new FLTTerm(a - flt_round_tolerancy)); } break; case OPRType.DBL_EQUAL: B = TStack.Pop(); A = TStack.Pop(); if (A.GetTermType == TermTypes.VAR) { A = GetObjectFromVAR(A); } if (B.GetTermType == TermTypes.VAR) { B = GetObjectFromVAR(B); } if (A.GetTermType == TermTypes.INT) { long a = BytesToINT(A.GetBitValue); if (B.GetTermType == TermTypes.INT) { long b = BytesToINT(B.GetBitValue); TStack.Push(new INTTerm(LogicNumber(a == b))); //a and b are "booleans" } if (B.GetTermType == TermTypes.FLT) { double b = BytesToDBL(B.GetBitValue); TStack.Push(new INTTerm(LogicNumber(a > (b - flt_round_tolerancy) || a < (b + flt_round_tolerancy)))); } } if (A.GetTermType == TermTypes.FLT) { double a = BytesToDBL(A.GetBitValue); if (B.GetTermType == TermTypes.INT) { long b = BytesToINT(B.GetBitValue); TStack.Push(new INTTerm(LogicNumber(b > (a - flt_round_tolerancy) || b < (a + flt_round_tolerancy)))); } if (B.GetTermType == TermTypes.FLT) { double b = BytesToDBL(B.GetBitValue); long tmp1 = (long)(b + flt_round_tolerancy); TStack.Push(new INTTerm(LogicNumber(a == b))); } } break; case OPRType.LEFT_SHIFT: B = TStack.Pop(); A = TStack.Pop(); if (A.GetTermType == TermTypes.VAR) { A = GetObjectFromVAR(A); } if (B.GetTermType == TermTypes.VAR) { B = GetObjectFromVAR(B); } if (A.GetTermType == TermTypes.INT) { long a = BytesToINT(A.GetBitValue); if (B.GetTermType == TermTypes.INT) { long b = BytesToINT(B.GetBitValue) % 64; TStack.Push(new INTTerm(a << (int)b)); } if (B.GetTermType == TermTypes.FLT) { double b = BytesToDBL(B.GetBitValue); TStack.Push(new INTTerm(a << (int)(b + flt_round_tolerancy) % 64)); } } if (A.GetTermType == TermTypes.FLT) { double a = BytesToDBL(A.GetBitValue); long tmp = (long)(a + flt_round_tolerancy); if (B.GetTermType == TermTypes.INT) { long b = BytesToINT(B.GetBitValue); TStack.Push(new INTTerm(tmp << (int)(b % 64))); } if (B.GetTermType == TermTypes.FLT) { double b = BytesToDBL(B.GetBitValue); long tmp1 = (long)(b + flt_round_tolerancy) % 64; TStack.Push(new INTTerm(tmp << (int)tmp1)); } } break; case OPRType.RIGHT_SHIFT: B = TStack.Pop(); A = TStack.Pop(); if (A.GetTermType == TermTypes.VAR) { A = GetObjectFromVAR(A); } if (B.GetTermType == TermTypes.VAR) { B = GetObjectFromVAR(B); } if (A.GetTermType == TermTypes.INT) { long a = BytesToINT(A.GetBitValue); if (B.GetTermType == TermTypes.INT) { long b = BytesToINT(B.GetBitValue) % 64; TStack.Push(new INTTerm(a >> (int)b)); } if (B.GetTermType == TermTypes.FLT) { double b = BytesToDBL(B.GetBitValue); TStack.Push(new INTTerm(a >> (int)(b + flt_round_tolerancy) % 64)); } } if (A.GetTermType == TermTypes.FLT) { double a = BytesToDBL(A.GetBitValue); long tmp = (long)(a + flt_round_tolerancy); if (B.GetTermType == TermTypes.INT) { long b = BytesToINT(B.GetBitValue); TStack.Push(new INTTerm(tmp >> (int)(b % 64))); } if (B.GetTermType == TermTypes.FLT) { double b = BytesToDBL(B.GetBitValue); long tmp1 = (long)(b + flt_round_tolerancy) % 64; TStack.Push(new INTTerm(tmp >> (int)tmp1)); } } break; } } }