rename executable computor

This commit is contained in:
hugogogo
2026-05-13 22:25:18 +02:00
parent a91ad5461f
commit b0e6483a68
5 changed files with 70 additions and 5 deletions

2
.gitignore vendored
View File

@@ -1,4 +1,4 @@
computorv1
computor
# ---> C
# Prerequisites

56
.vscode/launch.json vendored Normal file

File diff suppressed because one or more lines are too long

View File

@@ -31,7 +31,7 @@ RESET = "\e[0m"
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - #
# FILES :
NAME = computorv1
NAME = computor
D_LIB = ./libft
D_HEADERS = ./headers
HEADERS = computorv1.h
@@ -145,6 +145,10 @@ run: $(NAME)
-./$(NAME) $(RUN_FLAGS) "2x + x -0 = -7x"
@echo $(B_PURPLE)"\n---------------------------------------------\n21. degree 1 \n"$(RESET)
-./$(NAME) $(RUN_FLAGS) "2x + x -3 = -7x"
@echo $(B_PURPLE)"\n---------------------------------------------\n23. degree 2 SHOULD FAIL \n"$(RESET)
-./$(NAME) $(RUN_FLAGS) "3x^2"
@echo $(B_PURPLE)"\n---------------------------------------------\n23. degree 2 \n"$(RESET)
-./$(NAME) $(RUN_FLAGS) "3x^2 = 0"
clean:
$(RM_OBJS)

View File

@@ -1,5 +1,11 @@
# 42_EXT_05_computorv1
## todo
- change "compputorv1" to "computor"
- doing gcd for int values, and not for double values
- double is nearly_equal_0
## ressources
@@ -69,7 +75,6 @@ this project uses submodules (maybe recursively), so either :
- delta_sqrt; // √|Δ|
- first_term; // double (-b / 2a)
- second_term; // double (√|Δ| / 2a)
- double solution1; // first_term + second_term || -b / 2a + √|Δ| * i / 2a
- double solution2; // first_term - second_term || -b / 2a - √|Δ| * i / 2a
6. print solution

View File

@@ -191,8 +191,8 @@ void print_solution(s_solution *solution)
else if (solution_d2.delta_sign < 0)
{
ft_printf("Discriminant is strictly negative, the two complex solutions are:\n");
printf("%g/%g + %gi/%g\n", solution_d2.b * -1, solution_d2.a * 2, solution_d2.delta_absolute, solution_d2.a * 2);
printf("%g/%g - %gi/%g\n", solution_d2.b * -1, solution_d2.a * 2, solution_d2.delta_absolute, solution_d2.a * 2);
printf("%g/%g + %gi/%g\n", solution_d2.b * -1, solution_d2.a * 2, solution_d2.delta_sqrt, solution_d2.a * 2);
printf("%g/%g - %gi/%g\n", solution_d2.b * -1, solution_d2.a * 2, solution_d2.delta_sqrt, solution_d2.a * 2);
}
else
{