using uCalcSoftware; var uc = new uCalc(); // Goal: Define a new power operator '**' with higher precedence than multiplication '*'. var mul_precedence = uc.ItemOf("*", uCalc.Properties(ItemIs.Infix)).Precedence; // Set the new operator's precedence to be higher than multiplication. uc.DefineOperator("{base} ** {exp} = Pow(base, exp)", mul_precedence + 10); // The new operator should be evaluated before multiplication and addition. // The expression is equivalent to: 2 + (3 * (2 ** 3)) -> 2 + (3 * 8) -> 2 + 24 -> 26 Console.WriteLine(uc.Eval("2 + 3 * 2 ** 3"));