fix superscript 1

This commit is contained in:
hugogogo
2026-05-07 14:28:58 +02:00
parent f373fef4ac
commit 09701f8884
9 changed files with 75 additions and 23 deletions

View File

@@ -15,7 +15,7 @@ void print_debug(const char *description, ...)
va_end(args);
}
void print_before_solution(double *polynom, int max_exponent)
void print_reduced_form(double *polynom, int max_exponent)
{
int i;
@@ -40,16 +40,33 @@ void print_before_solution(double *polynom, int max_exponent)
i--;
}
ft_putstr("= 0\n");
}
// // check errors
// ft_printf(": ");
// ft_printf(": ");
// ft_printf(": ");
void print_degree(double *polynom, int max_exponent)
{
// degree
ft_printf("Polynomial degree: %i\n", max_exponent);
if (max_exponent > 2)
if (max_exponent == 0)
{
if (polynom[0] == 0)
{
stop_errors("Any real number is a solution.\n");
}
else if (polynom[0] != 0)
{
stop_errors("No solution.\n");
}
}
else if (max_exponent == 1)
{
ft_printf("Polynomial degree: %i\n", max_exponent);
}
else if (max_exponent == 2)
{
ft_printf("Polynomial degree: %i\n", max_exponent);
}
else
{
ft_printf("Polynomial degree: %i\n", max_exponent);
stop_errors("The polynomial degree is strictly greater than 2, I can't solve.\n");
}
}