Пример #1
0
        public override IodineObject Xor(VirtualMachine vm, IodineObject right)
        {
            IodineInteger intVal = right as IodineInteger;
            IodineBigInt  bigVal = right as IodineBigInt;

            if (intVal == null)
            {
                if (bigVal != null)
                {
                    return(new IodineBigInt(Value ^ bigVal.Value));
                }
                vm.RaiseException(new IodineTypeException("Right hand side must be of type Int!"));
                return(null);
            }
            return(new IodineInteger(Value ^ intVal.Value));
        }
Пример #2
0
        public override IodineObject GreaterThanOrEqual(VirtualMachine vm, IodineObject right)
        {
            IodineInteger intVal   = right as IodineInteger;
            IodineBigInt  bigVal   = right as IodineBigInt;
            IodineFloat   floatVal = right as IodineFloat;

            if (intVal == null)
            {
                if (bigVal != null)
                {
                    return(IodineBool.Create(Value >= bigVal.Value));
                }
                if (floatVal != null)
                {
                    return(IodineBool.Create(Value >= floatVal.Value));
                }
                vm.RaiseException(new IodineTypeException("Right hand side must be of type Int!"));
            }
            return(IodineBool.Create(Value >= intVal.Value));
        }
Пример #3
0
        public override IodineObject NotEquals(VirtualMachine vm, IodineObject right)
        {
            IodineInteger intVal   = right as IodineInteger;
            IodineBigInt  bigVal   = right as IodineBigInt;
            IodineFloat   floatVal = right as IodineFloat;

            if (intVal == null)
            {
                if (bigVal != null)
                {
                    return(IodineBool.Create(Value != bigVal.Value));
                }
                if (floatVal != null)
                {
                    return(IodineBool.Create(Math.Abs(Value - floatVal.Value) > double.Epsilon));
                }
                vm.RaiseException(new IodineTypeException("Right hand side must be of type Int!"));
                return(null);
            }
            return(IodineBool.Create(Value != intVal.Value));
        }