Exemplo n.º 1
0
        public virtual IDynamic Op_Modulus(IDynamic other)
        {
            var lnum = (double)this.ConvertToNumber().BaseValue;
            var rnum = (double)other.ConvertToNumber().BaseValue;

            return(Environment.CreateNumber(lnum % rnum));
        }
Exemplo n.º 2
0
        public override IDynamic Op_Equals(IDynamic other)
        {
            switch (other.TypeCode)
            {
            case LanguageTypeCode.String:
                return(this.Op_Equals(other.ConvertToNumber()));

            case LanguageTypeCode.Number:
                var lnum = (LNumber)other;
                return(Environment.CreateBoolean(!(double.IsNaN(BaseValue) || double.IsNaN(lnum.BaseValue)) && this.BaseValue == lnum.BaseValue));

            case LanguageTypeCode.Object:
                return(this.Op_Equals(other.ConvertToPrimitive(null)));

            default:
                return(Environment.False);
            }
        }
Exemplo n.º 3
0
 public virtual IDynamic Op_Subtraction(IDynamic other)
 {
     var lnum = (double)this.ConvertToNumber().BaseValue;
     var rnum = (double)other.ConvertToNumber().BaseValue;
     return Environment.CreateNumber(lnum - rnum);
 }
Exemplo n.º 4
0
 public override IDynamic Op_Equals(IDynamic other)
 {
     switch (other.TypeCode)
     {
         case LanguageTypeCode.String:
             return this.Op_Equals(other.ConvertToNumber());
         case LanguageTypeCode.Number:
             var lnum = (LNumber)other;
             return Environment.CreateBoolean(!(double.IsNaN(BaseValue) || double.IsNaN(lnum.BaseValue)) && this.BaseValue == lnum.BaseValue);
         case LanguageTypeCode.Object:
             return this.Op_Equals(other.ConvertToPrimitive(null));
         default:
             return Environment.False;
     }
 }