public MinusOperator() { Minus = Utils.MakeOperator(LConstants.MINUS_OP, 1, true, (values, op) => { op.CheckParamCount(values.Length); MeNumber result = values[0].Get <float>() - values[1].Get <float>(); return(result); }, CommonValidators.TwoNumbers, CommonParamTypes.TwoNumbers); }
public PowerOperator() { Power = Utils.MakeOperator(LConstants.POWER_OP, 3, true, (values, op) => { op.CheckParamCount(values.Length); MeNumber result = (float)Math.Pow(values[0].Get <float>(), values[1].Get <float>()); return(result); }, CommonValidators.TwoNumbers, CommonParamTypes.TwoNumbers); }
public AbsFunction() { Abs = Utils.MakeFunction(LConstants.ABS_F, (values, func) => { func.CheckParamCount(values.Length); MeNumber result = (float)Math.Abs(values[0].Get <float>()); return(result); }, CommonParamTypes.SingleNumber, CommonValidators.SingleNumber); }
public DivideOperator() { Divide = Utils.MakeOperator(LConstants.DIVIDE_OP, 2, true, (values, op) => { op.CheckParamCount(values.Length); MeNumber result = values[0].Get <float>() / values[1].Get <float>(); return(result); }, CommonValidators.TwoNumbers, CommonParamTypes.TwoNumbers); }
public MultiplyOperator() { Multiply = Utils.MakeOperator(LConstants.MULITPLY_OP, 2, true, (values, op) => { op.CheckParamCount(values.Length); MeNumber result = values[0].Get <float>() * values[1].Get <float>(); return(result); }, CommonValidators.TwoNumbers, CommonParamTypes.TwoNumbers); }
public MaxFunction() { Max = Utils.MakeFunction(LConstants.MAX_F, (values, func) => { func.CheckParamCount(values.Length); float[] parameters = MeArray.ToFloatArray(values); MeNumber maxNumber = parameters.Max(); return(maxNumber); }, CommonParamTypes.SingleNumber, CommonValidators.NumberArray, false); }
public NonNegFunction() { NonNeg = Utils.MakeFunction(LConstants.NON_NEG_F, (values, func) => { func.CheckParamCount(values.Length); float value = values[0].Get <float>(); MeNumber result = value > 0 ? value : 0; return(result); }, CommonParamTypes.SingleNumber, CommonValidators.SingleNumber); }
public MinFunction() { Min = Utils.MakeFunction(LConstants.MIN_F, (values, func) => { func.CheckParamCount(values.Length); float[] parameters = MeArray.ToFloatArray(values); MeNumber result = parameters.Min(); return(result); }, CommonParamTypes.SingleNumber, CommonValidators.NumberArray, false); }