Exemple #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));
        }
Exemple #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));
        }
Exemple #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));
        }