fix reducer sign error

This commit is contained in:
hugogogo
2026-05-15 01:03:14 +02:00
parent 7e16bb5b6f
commit b185647d2b
5 changed files with 25 additions and 22 deletions

View File

@@ -21,7 +21,8 @@ static double get_all_terms_with_exponent(s_term *terms, int exponent)
// sign
sign = 1;
if (terms[i].position == TERM_RIGHT)
sign = terms[i].sign == TERM_PLUS ? -1 : 1;
sign = -1;
// sign = terms[i].sign == TERM_PLUS ? -1 : 1;
// add coefficients
coefficient += terms[i].coefficient * sign;

View File

@@ -14,7 +14,7 @@ static void solve_degree_1(s_solution_degree_1 *solution, double a, double b)
solution->a = a;
solution->b = b;
solution->solution = positiv_zero(-b / a); // -b / a
solution->solution = positiv_zero(-b / a);
}
static void solve_degree_2(s_solution_degree_2 *solution, double a, double b, double c)