protected bool Equals(AstNumber other) { switch (t) { case Type.Integer: return(t == other.t && i == other.i); case Type.Double: return(t == other.t && d.Equals(other.d)); default: throw new Exception("AstNumber was not of known type!"); } }
public static AstNumber Multiply <TSource>(this IEnumerable <TSource> source, Func <TSource, AstNumber> selector) { if (source == null) { throw new ArgumentNullException(); } if (selector == null) { throw new ArgumentNullException(); } var num = new AstNumber(1); foreach (var source1 in source) { num *= selector(source1); } return(num); }