Убраны лишние скобки для построения представлений функций

This commit is contained in:
2021-05-08 20:19:39 +03:00
parent e9840a1bbb
commit 1ee802d8f2

View File

@@ -238,7 +238,7 @@ vector<MyFunction> get_linear_combinations(const vector<MyFunction> &linear_comp
} }
string preprocess_factor(string factor) { string preprocess_factor(string factor) {
if ( factor.find("+") != string::npos and factor.find("*") == string::npos ) if ( factor.find("+") != string::npos and factor.find("*") == string::npos and factor[0] !='(' and factor[factor.size() - 1] != ')')
return "(" + factor + ")"; return "(" + factor + ")";
return factor; return factor;
} }