fix coefficient sign error

This commit is contained in:
hugogogo
2026-05-14 12:42:57 +02:00
parent bbe0d65b1f
commit 3761adcf11

View File

@@ -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;