diff --git a/src/reducer.c b/src/reducer.c index 3f50294..caaefc6 100644 --- a/src/reducer.c +++ b/src/reducer.c @@ -19,9 +19,9 @@ static double get_all_terms_with_exponent(s_term *terms, int exponent) } // sign - sign = terms[i].sign == TERM_PLUS ? 1 : -1; + sign = 1; if (terms[i].position == TERM_RIGHT) - sign *= -1; + sign = terms[i].sign == TERM_PLUS ? -1 : 1; // add coefficients coefficient += terms[i].coefficient * sign;