print degree ok

This commit is contained in:
hugogogo
2026-05-07 19:45:42 +02:00
parent 23c788d0c2
commit 0fcfd0260d
3 changed files with 6 additions and 5 deletions

View File

@@ -144,8 +144,12 @@ run: $(NAME)
-./$(NAME) -b "3x² + 0x -0 = x"
@echo $(B_PURPLE)"\n---------------------------------------------\n22. run -b \n"$(RESET)
-./$(NAME) -b "3x² + x -0 = x"
@echo $(B_PURPLE)"\n---------------------------------------------\n22. run -b \n"$(RESET)
@echo $(B_PURPLE)"\n---------------------------------------------\n23. run -b \n"$(RESET)
-./$(NAME) -b "0x² + x -0 = x"
@echo $(B_PURPLE)"\n---------------------------------------------\n24. run -b \n"$(RESET)
-./$(NAME) -b "2x⁵ + x -0 = -7x^5"
@echo $(B_PURPLE)"\n---------------------------------------------\n25. run -b \n"$(RESET)
-./$(NAME) -b "2x + x -0 = -7x"
clean:
$(RM_OBJS)

View File

@@ -170,7 +170,7 @@ void launch_computorv1(char *input)
// print before solution
print_reduced_form(polynom);
// print_degree(polynom, degree);
print_degree(polynom, degree);
// // solve
// s_solution solution[1];

View File

@@ -40,16 +40,13 @@ static void print_reduced_form_beautify(s_polynom *polynom)
{
coefficient = ft_fabs(polynom[i].coefficient);
exponent = polynom[i].exponent;
// dprintf(STDERR_FILENO, "\nDEBUG: polynom[0].coefficient: %g, polynom[0].exponent: %i, polynom[0].sign: %c\n", polynom[0].coefficient, polynom[0].exponent, polynom[0].sign); // tmpdebug
// if term is zero dont output
if (coefficient == 0.0)
{
// ft_dprintf(STDERR_FILENO, "DEBUG: is 0\n"); // tmpdebug
i++;
continue;
}
// ft_dprintf(STDERR_FILENO, "DEBUG: is not 0\n"); // tmpdebug
// default_form is not nedded anymore since something will be printed
default_form = "";