diff --git a/MathParser.cs b/MathParser.cs index 175ac37..01e11a7 100644 --- a/MathParser.cs +++ b/MathParser.cs @@ -305,7 +305,7 @@ private string LexicalAnalysisInfixNotation(string expression, ref int pos) if (supportedOperators.ContainsKey(token.ToString())) { // Determine it is unary or binary operator - bool isUnary = pos == 0 || expression[pos - 1] == '('; + bool isUnary = pos == 0 || "+-*/^(".Contains(expression[pos - 1].ToString()); pos++; switch (token.ToString()) @@ -739,4 +739,4 @@ private int NumberOfArguments(string token) #endregion } -} \ No newline at end of file +}