From 3761adcf1197a403d58ea4fdc1b67f3c7f5525e7 Mon Sep 17 00:00:00 2001 From: hugogogo Date: Thu, 14 May 2026 12:42:57 +0200 Subject: [PATCH] fix coefficient sign error --- src/reducer.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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;