change output to use discriminant instead of radicant
This commit is contained in:
@@ -18,7 +18,7 @@ static void print_solution_degree_1(s_solution_degree_1 solution)
|
|||||||
|
|
||||||
static void print_solution_pure_radicand_zero()
|
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");
|
printf("0\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -27,7 +27,7 @@ static void print_solution_pure_radicand_positiv(s_solution_degree_2_pure soluti
|
|||||||
double numerator;
|
double numerator;
|
||||||
double denominator;
|
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)
|
if (solution.numerator_sqrt_is_int && solution.denominator_sqrt_is_int)
|
||||||
{
|
{
|
||||||
numerator = solution.numerator_sqrt;
|
numerator = solution.numerator_sqrt;
|
||||||
@@ -77,7 +77,7 @@ static void print_solution_pure_radicand_negativ(s_solution_degree_2_pure soluti
|
|||||||
double numerator;
|
double numerator;
|
||||||
double denominator;
|
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)
|
if (solution.numerator_sqrt_is_int && solution.denominator_sqrt_is_int)
|
||||||
{
|
{
|
||||||
numerator = solution.numerator_sqrt;
|
numerator = solution.numerator_sqrt;
|
||||||
|
|||||||
36
tester.sh
36
tester.sh
@@ -134,20 +134,20 @@ run_test() {
|
|||||||
run_test \
|
run_test \
|
||||||
"1. degree 2" \
|
"1. degree 2" \
|
||||||
"3 * x^2 + 5 * x^1 - 2 * x^0 = 5 * x^1" "\
|
"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
|
Polynomial degree: 2
|
||||||
Discriminant is strictly negative, the two complex solutions are:
|
Discriminant is strictly positive, the two solutions are:
|
||||||
-√(2/3)
|
√(2/3)
|
||||||
√(2/3)"
|
-√(2/3)"
|
||||||
|
|
||||||
run_test \
|
run_test \
|
||||||
"2. degree 2" \
|
"2. degree 2" \
|
||||||
"3.4 * x^2 + 1 * x^1 - 2.0 * x^0 = 5 * x^1" "\
|
"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
|
Polynomial degree: 2
|
||||||
Discriminant is strictly negative, the two complex solutions are:
|
Discriminant is strictly positive, the two solutions are:
|
||||||
4/6.8 + 3.34664i/6.8
|
1.5548
|
||||||
4/6.8 - 3.34664i/6.8"
|
-0.378334"
|
||||||
|
|
||||||
run_test \
|
run_test \
|
||||||
"3. degree 2" \
|
"3. degree 2" \
|
||||||
@@ -155,8 +155,8 @@ run_test \
|
|||||||
Reduced form: 0 * x^0 - 5 * x^1 + 5 * x^2 = 0
|
Reduced form: 0 * x^0 - 5 * x^1 + 5 * x^2 = 0
|
||||||
Polynomial degree: 2
|
Polynomial degree: 2
|
||||||
Discriminant is strictly positive, the two solutions are:
|
Discriminant is strictly positive, the two solutions are:
|
||||||
13
|
1
|
||||||
-12"
|
0"
|
||||||
|
|
||||||
run_test \
|
run_test \
|
||||||
"4. flag -e" \
|
"4. flag -e" \
|
||||||
@@ -271,7 +271,7 @@ run_test \
|
|||||||
"3x² + x -0 = x" "\
|
"3x² + x -0 = x" "\
|
||||||
Reduced form: 0 * x^0 + 0 * x^1 + 3 * x^2 = 0
|
Reduced form: 0 * x^0 + 0 * x^1 + 3 * x^2 = 0
|
||||||
Polynomial degree: 2
|
Polynomial degree: 2
|
||||||
Radicant is equal to zero, the solution is:
|
Discriminant is equal to zero, the solution is:
|
||||||
0"
|
0"
|
||||||
|
|
||||||
run_test \
|
run_test \
|
||||||
@@ -322,7 +322,7 @@ run_test \
|
|||||||
"3x^2 = 0" "\
|
"3x^2 = 0" "\
|
||||||
Reduced form: 0 * x^0 + 0 * x^1 + 3 * x^2 = 0
|
Reduced form: 0 * x^0 + 0 * x^1 + 3 * x^2 = 0
|
||||||
Polynomial degree: 2
|
Polynomial degree: 2
|
||||||
Radicant is equal to zero, the solution is:
|
Discriminant is equal to zero, the solution is:
|
||||||
0"
|
0"
|
||||||
|
|
||||||
run_test \
|
run_test \
|
||||||
@@ -330,7 +330,7 @@ run_test \
|
|||||||
"3x^2 + 2 = 0" "\
|
"3x^2 + 2 = 0" "\
|
||||||
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
|
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)
|
||||||
-i√(2/3)"
|
-i√(2/3)"
|
||||||
|
|
||||||
@@ -339,7 +339,7 @@ run_test \
|
|||||||
"3 * x^2 + 5 * x^1 - 2 * x^0 = 5 * x" "\
|
"3 * x^2 + 5 * x^1 - 2 * x^0 = 5 * x" "\
|
||||||
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
|
Polynomial degree: 2
|
||||||
Radicant is strictly positive, the two solutions are:
|
Discriminant is strictly positive, the two solutions are:
|
||||||
√(2/3)
|
√(2/3)
|
||||||
-√(2/3)"
|
-√(2/3)"
|
||||||
|
|
||||||
@@ -348,7 +348,7 @@ run_test \
|
|||||||
"9 * x^2 + 5 * x^1 - 2 * x^0 = 5 * x" "\
|
"9 * x^2 + 5 * x^1 - 2 * x^0 = 5 * x" "\
|
||||||
Reduced form: -2 * x^0 + 0 * x^1 + 9 * x^2 = 0
|
Reduced form: -2 * x^0 + 0 * x^1 + 9 * x^2 = 0
|
||||||
Polynomial degree: 2
|
Polynomial degree: 2
|
||||||
Radicant is strictly positive, the two solutions are:
|
Discriminant is strictly positive, the two solutions are:
|
||||||
√(2)/3
|
√(2)/3
|
||||||
-√(2)/3"
|
-√(2)/3"
|
||||||
|
|
||||||
@@ -357,7 +357,7 @@ run_test \
|
|||||||
"3 * x^2 + 5 * x^1 - 4 * x^0 = 5 * x" "\
|
"3 * x^2 + 5 * x^1 - 4 * x^0 = 5 * x" "\
|
||||||
Reduced form: -4 * x^0 + 0 * x^1 + 3 * x^2 = 0
|
Reduced form: -4 * x^0 + 0 * x^1 + 3 * x^2 = 0
|
||||||
Polynomial degree: 2
|
Polynomial degree: 2
|
||||||
Radicant is strictly positive, the two solutions are:
|
Discriminant is strictly positive, the two solutions are:
|
||||||
2/√(3)
|
2/√(3)
|
||||||
-2/√(3)"
|
-2/√(3)"
|
||||||
|
|
||||||
@@ -366,7 +366,7 @@ run_test \
|
|||||||
"16 * x^2 + 5 * x^1 - 4 * x^0 = 5 * x" "\
|
"16 * x^2 + 5 * x^1 - 4 * x^0 = 5 * x" "\
|
||||||
Reduced form: -4 * x^0 + 0 * x^1 + 16 * x^2 = 0
|
Reduced form: -4 * x^0 + 0 * x^1 + 16 * x^2 = 0
|
||||||
Polynomial degree: 2
|
Polynomial degree: 2
|
||||||
Radicant is strictly positive, the two solutions are:
|
Discriminant is strictly positive, the two solutions are:
|
||||||
1/2
|
1/2
|
||||||
-1/2"
|
-1/2"
|
||||||
|
|
||||||
@@ -375,7 +375,7 @@ run_test \
|
|||||||
"4 * x^2 + 5 * x^1 - 16 * x^0 = 5 * x" "\
|
"4 * x^2 + 5 * x^1 - 16 * x^0 = 5 * x" "\
|
||||||
Reduced form: -16 * x^0 + 0 * x^1 + 4 * x^2 = 0
|
Reduced form: -16 * x^0 + 0 * x^1 + 4 * x^2 = 0
|
||||||
Polynomial degree: 2
|
Polynomial degree: 2
|
||||||
Radicant is strictly positive, the two solutions are:
|
Discriminant is strictly positive, the two solutions are:
|
||||||
2
|
2
|
||||||
-2"
|
-2"
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user