public virtual IDynamic Op_Modulus(IDynamic other) { var lnum = (double)this.ConvertToNumber().BaseValue; var rnum = (double)other.ConvertToNumber().BaseValue; return(Environment.CreateNumber(lnum % rnum)); }
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); } }
public virtual IDynamic Op_Subtraction(IDynamic other) { var lnum = (double)this.ConvertToNumber().BaseValue; var rnum = (double)other.ConvertToNumber().BaseValue; return Environment.CreateNumber(lnum - rnum); }
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; } }