static void matchInternal(MItem unit, SMath.Math.Numeric.TNumber val, ref SMath.Math.Store context) { // First, reduce our units to basic representation to allow MathEqual() var t = SMath.Math.Decision.Preprocessing(unit.ToEntry(), context); var u = Expression.SimplifyEx(Converter.ToMItem(t), context); if (!val.obj.Units.MathEqual(u) && !val.obj.Units.MathEqual(unitless)) { throw new SMath.Manager.MathException(SMath.Manager.Errors.UnitsDontMatch); } }
public static void matchHA(string param, SMath.Math.Numeric.TNumber val, SMath.Math.Store context) { matchInternal(FindHA(param), val, ref context); }