fix atoi_supescript

This commit is contained in:
hugogogo
2026-05-15 02:30:13 +02:00
parent f25291f12f
commit 0603050d30
3 changed files with 171 additions and 171 deletions

View File

@@ -108,7 +108,7 @@ run: $(NAME)
test: $(NAME)
@echo $(B_PURPLE)"\n---------------------------------------------\nlaunch tests\n"$(RESET)
-@bash tester.sh -d
-@bash tester.sh
clean:
$(RM_OBJS)

2
libft

Submodule libft updated: e95f55c07f...71806cb923

338
tester.sh
View File

@@ -201,189 +201,189 @@ run_test \
Reduced form: 0 * x^0 - 6 * x^1 + 3 * x^2 = 0
Polynomial degree: 2
Discriminant is strictly positive, the two solutions are:
2
0"
run_test \
"10. degree 2" \
"3 * x^2 + 2 * x - 7 * x^1 = x" "\
Reduced form: 0 * x^0 - 6 * x^1 + 3 * x^2 = 0
Polynomial degree: 2
Discriminant is strictly positive, the two solutions are:
2
0"
run_test \
"11. degree 2" \
"-3x² + 2x -7 = x" "\
Reduced form: -7 * x^0 + 1 * x^1 - 3 * x^2 = 0
Polynomial degree: 2
Discriminant is strictly negative, the two complex solutions are:
0.166667 - 1.51841*i
0.166667 + 1.51841*i"
run_test \
"12. degree 2" \
"+3x² + 2x -7 = x" "\
Reduced form: -7 * x^0 + 1 * x^1 + 3 * x^2 = 0
Polynomial degree: 2
Discriminant is strictly positive, the two solutions are:
1.36992
-1.70326"
run_test \
"13. degree 2" \
"3x² + 0x -7 = x" "\
Reduced form: -7 * x^0 - 1 * x^1 + 3 * x^2 = 0
Polynomial degree: 2
Discriminant is strictly positive, the two solutions are:
1.70326
-1.36992"
run_test \
"14. degree 2" \
"3x² + 0x -0 = x" "\
Reduced form: 0 * x^0 - 1 * x^1 + 3 * x^2 = 0
Polynomial degree: 2
Discriminant is strictly positive, the two solutions are:
0.333333
0"
run_test \
"15. degree 2" \
"3x² + 2x -0 = x" "\
Reduced form: 0 * x^0 + 1 * x^1 + 3 * x^2 = 0
Polynomial degree: 2
Discriminant is strictly positive, the two solutions are:
0
2"
-0.333333"
# run_test \
# "10. degree 2" \
# "3 * x^2 + 2 * x - 7 * x^1 = x" "\
# Reduced form: 0 * x^0 - 6 * x^1 + 3 * x^2 = 0
# Polynomial degree: 2
# Discriminant is strictly positive, the two solutions are:
# 2
# 0"
run_test \
"16. degree 1" \
"3x + 2x -0 = x" "\
Reduced form: 0 * x^0 + 4 * x^1 = 0
Polynomial degree: 1
The solution is:
0"
# run_test \
# "11. degree 2" \
# "-3x² + 2x -7 = x" "\
# Reduced form: -7 * x^0 + 1 * x^1 - 3 * x^2 = 0
# Polynomial degree: 2
# Discriminant is strictly negative, the two complex solutions are:
# 0.166667 - 1.51841*i
# 0.166667 + 1.51841*i"
run_test \
"17. degree 2" \
"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:
0"
# run_test \
# "12. degree 2" \
# "+3x² + 2x -7 = x" "\
# Reduced form: -7 * x^0 + 1 * x^1 + 3 * x^2 = 0
# Polynomial degree: 2
# Discriminant is strictly positive, the two solutions are:
# 1.36992
# -1.70326"
run_test \
"18. degree 2" \
"0x² + x -0 = x" "\
Reduced form: 0 * x^0 = 0
Any real number is a solution."
# run_test \
# "13. degree 2" \
# "3x² + 0x -7 = x" "\
# Reduced form: -7 * x^0 - 1 * x^1 + 3 * x^2 = 0
# Polynomial degree: 2
# Discriminant is strictly positive, the two solutions are:
# 1.70326
# -1.36992"
run_test \
"19. degree 5" \
"2x⁵ + x -0 = -7x^5" "\
Reduced form: 0 * x^0 + 1 * x^1 + 0 * x^2 + 0 * x^3 + 0 * x^4 + 9 * x^5 = 0
Polynomial degree: 5
The polynomial degree is strictly greater than 2, I can't solve."
# run_test \
# "14. degree 2" \
# "3x² + 0x -0 = x" "\
# Reduced form: 0 * x^0 - 1 * x^1 + 3 * x^2 = 0
# Polynomial degree: 2
# Discriminant is strictly positive, the two solutions are:
# 0.333333
# 0"
run_test \
"20. degree 1" \
"2x + x -0 = -7x" "\
Reduced form: 0 * x^0 + 10 * x^1 = 0
Polynomial degree: 1
The solution is:
0"
# run_test \
# "15. degree 2" \
# "3x² + 2x -0 = x" "\
# Reduced form: 0 * x^0 + 1 * x^1 + 3 * x^2 = 0
# Polynomial degree: 2
# Discriminant is strictly positive, the two solutions are:
# 0
# -0.333333"
run_test \
"21. degree 1" \
"2x + x -3 = -7x" "\
Reduced form: -3 * x^0 + 10 * x^1 = 0
Polynomial degree: 1
The solution is:
0.3"
# run_test \
# "16. degree 1" \
# "3x + 2x -0 = x" "\
# Reduced form: 0 * x^0 + 4 * x^1 = 0
# Polynomial degree: 1
# The solution is:
# 0"
run_test \
"22. degree 1" \
"-2x + x -3 = -7x" "\
Reduced form: -3 * x^0 + 6 * x^1 = 0
Polynomial degree: 1
The solution is:
0.5"
# run_test \
# "17. degree 2" \
# "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:
# 0"
run_test \
"23. degree 2 without [=]" \
"3x^2" \
"" \
error
# run_test \
# "18. degree 2" \
# "0x² + x -0 = x" "\
# Reduced form: 0 * x^0 = 0
# Any real number is a solution."
run_test \
"24. degree 2" \
"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:
0"
# run_test \
# "19. degree 5" \
# "2x⁵ + x -0 = -7x^5" "\
# Reduced form: 0 * x^0 + 1 * x^1 + 0 * x^2 + 0 * x^3 + 0 * x^4 + 9 * x^5 = 0
# Polynomial degree: 5
# The polynomial degree is strictly greater than 2, I can't solve."
run_test \
"25. degree 2" \
"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:
i√(2/3)
-i√(2/3)"
# run_test \
# "20. degree 1" \
# "2x + x -0 = -7x" "\
# Reduced form: 0 * x^0 + 10 * x^1 = 0
# Polynomial degree: 1
# The solution is:
# 0"
run_test \
"26. degree 2 pure" \
"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:
√(2/3)
-√(2/3)"
# run_test \
# "21. degree 1" \
# "2x + x -3 = -7x" "\
# Reduced form: -3 * x^0 + 10 * x^1 = 0
# Polynomial degree: 1
# The solution is:
# 0.3"
run_test \
"27. degree 2 pure" \
"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:
√(2)/3
-√(2)/3"
# run_test \
# "22. degree 1" \
# "-2x + x -3 = -7x" "\
# Reduced form: -3 * x^0 + 6 * x^1 = 0
# Polynomial degree: 1
# The solution is:
# 0.5"
run_test \
"28. degree 2 pure" \
"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:
2/√(3)
-2/√(3)"
# run_test \
# "23. degree 2 without [=]" \
# "3x^2" \
# "" \
# error
run_test \
"29. degree 2 pure" \
"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:
1/2
-1/2"
# run_test \
# "24. degree 2" \
# "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:
# 0"
run_test \
"30. degree 2 pure" \
"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:
2
-2"
# run_test \
# "25. degree 2" \
# "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:
# i√(2/3)
# -i√(2/3)"
# run_test \
# "26. degree 2 pure" \
# "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:
# √(2/3)
# -√(2/3)"
# run_test \
# "27. degree 2 pure" \
# "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:
# √(2)/3
# -√(2)/3"
# run_test \
# "28. degree 2 pure" \
# "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:
# 2/√(3)
# -2/√(3)"
# run_test \
# "29. degree 2 pure" \
# "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:
# 1/2
# -1/2"
# run_test \
# "30. degree 2 pure" \
# "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:
# 2
# -2"
# run_test \
# "31. degree 2" \
# "3x² + 2x -7 = x" "\
# Reduced form: -7 * x^0 + 1 * x^1 + 3 * x^2 = 0
# Polynomial degree: 2
# Discriminant is strictly positive, the two solutions are:
# 1.36992
# -1.70326"
run_test \
"31. degree 2" \
"3x² + 2x -7 = x" "\
Reduced form: -7 * x^0 + 1 * x^1 + 3 * x^2 = 0
Polynomial degree: 2
Discriminant is strictly positive, the two solutions are:
1.36992
-1.70326"