change output to use discriminant instead of radicant

This commit is contained in:
hugogogo
2026-05-15 02:51:42 +02:00
parent 2824414f53
commit f1a6a8e586
2 changed files with 21 additions and 21 deletions

View File

@@ -18,7 +18,7 @@ static void print_solution_degree_1(s_solution_degree_1 solution)
static void print_solution_pure_radicand_zero()
{
ft_printf("Radicant is equal to zero, the solution is:\n");
ft_printf("Discriminant is equal to zero, the solution is:\n");
printf("0\n");
}
@@ -27,7 +27,7 @@ static void print_solution_pure_radicand_positiv(s_solution_degree_2_pure soluti
double numerator;
double denominator;
ft_printf("Radicant is strictly positive, the two solutions are:\n");
ft_printf("Discriminant is strictly positive, the two solutions are:\n");
if (solution.numerator_sqrt_is_int && solution.denominator_sqrt_is_int)
{
numerator = solution.numerator_sqrt;
@@ -77,7 +77,7 @@ static void print_solution_pure_radicand_negativ(s_solution_degree_2_pure soluti
double numerator;
double denominator;
ft_printf("Radicant is strictly negative, the two complex solutions are:\n");
ft_printf("Discriminant is strictly negative, the two complex solutions are:\n");
if (solution.numerator_sqrt_is_int && solution.denominator_sqrt_is_int)
{
numerator = solution.numerator_sqrt;

View File

@@ -134,20 +134,20 @@ run_test() {
run_test \
"1. degree 2" \
"3 * x^2 + 5 * x^1 - 2 * x^0 = 5 * x^1" "\
Reduced form: 2 * x^0 + 0 * x^1 + 3 * x^2 = 0
Reduced form: -2 * x^0 + 0 * x^1 + 3 * x^2 = 0
Polynomial degree: 2
Discriminant is strictly negative, the two complex solutions are:
-√(2/3)
√(2/3)"
Discriminant is strictly positive, the two solutions are:
√(2/3)
-√(2/3)"
run_test \
"2. degree 2" \
"3.4 * x^2 + 1 * x^1 - 2.0 * x^0 = 5 * x^1" "\
Reduced form: 2 * x^0 - 4 * x^1 + 3.4 * x^2 = 0
Reduced form: -2 * x^0 - 4 * x^1 + 3.4 * x^2 = 0
Polynomial degree: 2
Discriminant is strictly negative, the two complex solutions are:
4/6.8 + 3.34664i/6.8
4/6.8 - 3.34664i/6.8"
Discriminant is strictly positive, the two solutions are:
1.5548
-0.378334"
run_test \
"3. degree 2" \
@@ -155,8 +155,8 @@ run_test \
Reduced form: 0 * x^0 - 5 * x^1 + 5 * x^2 = 0
Polynomial degree: 2
Discriminant is strictly positive, the two solutions are:
13
-12"
1
0"
run_test \
"4. flag -e" \
@@ -271,7 +271,7 @@ run_test \
"3x² + x -0 = x" "\
Reduced form: 0 * x^0 + 0 * x^1 + 3 * x^2 = 0
Polynomial degree: 2
Radicant is equal to zero, the solution is:
Discriminant is equal to zero, the solution is:
0"
run_test \
@@ -322,7 +322,7 @@ run_test \
"3x^2 = 0" "\
Reduced form: 0 * x^0 + 0 * x^1 + 3 * x^2 = 0
Polynomial degree: 2
Radicant is equal to zero, the solution is:
Discriminant is equal to zero, the solution is:
0"
run_test \
@@ -330,7 +330,7 @@ run_test \
"3x^2 + 2 = 0" "\
Reduced form: 2 * x^0 + 0 * x^1 + 3 * x^2 = 0
Polynomial degree: 2
Radicant is strictly negative, the two complex solutions are:
Discriminant is strictly negative, the two complex solutions are:
i√(2/3)
-i√(2/3)"
@@ -339,7 +339,7 @@ run_test \
"3 * x^2 + 5 * x^1 - 2 * x^0 = 5 * x" "\
Reduced form: -2 * x^0 + 0 * x^1 + 3 * x^2 = 0
Polynomial degree: 2
Radicant is strictly positive, the two solutions are:
Discriminant is strictly positive, the two solutions are:
√(2/3)
-√(2/3)"
@@ -348,7 +348,7 @@ run_test \
"9 * x^2 + 5 * x^1 - 2 * x^0 = 5 * x" "\
Reduced form: -2 * x^0 + 0 * x^1 + 9 * x^2 = 0
Polynomial degree: 2
Radicant is strictly positive, the two solutions are:
Discriminant is strictly positive, the two solutions are:
√(2)/3
-√(2)/3"
@@ -357,7 +357,7 @@ run_test \
"3 * x^2 + 5 * x^1 - 4 * x^0 = 5 * x" "\
Reduced form: -4 * x^0 + 0 * x^1 + 3 * x^2 = 0
Polynomial degree: 2
Radicant is strictly positive, the two solutions are:
Discriminant is strictly positive, the two solutions are:
2/√(3)
-2/√(3)"
@@ -366,7 +366,7 @@ run_test \
"16 * x^2 + 5 * x^1 - 4 * x^0 = 5 * x" "\
Reduced form: -4 * x^0 + 0 * x^1 + 16 * x^2 = 0
Polynomial degree: 2
Radicant is strictly positive, the two solutions are:
Discriminant is strictly positive, the two solutions are:
1/2
-1/2"
@@ -375,7 +375,7 @@ run_test \
"4 * x^2 + 5 * x^1 - 16 * x^0 = 5 * x" "\
Reduced form: -16 * x^0 + 0 * x^1 + 4 * x^2 = 0
Polynomial degree: 2
Radicant is strictly positive, the two solutions are:
Discriminant is strictly positive, the two solutions are:
2
-2"