From 73c2b00a10c5786ddeeacc915e233fd4df1c9321 Mon Sep 17 00:00:00 2001 From: Martial Simon Date: Sat, 11 Oct 2025 22:19:00 +0200 Subject: fix: evalexpr & tinyprintf contenaient toute la piscine --- rushs/tinyprintf/handling_complex/complex.c | 51 ----------------------------- 1 file changed, 51 deletions(-) delete mode 100644 rushs/tinyprintf/handling_complex/complex.c (limited to 'rushs/tinyprintf/handling_complex/complex.c') diff --git a/rushs/tinyprintf/handling_complex/complex.c b/rushs/tinyprintf/handling_complex/complex.c deleted file mode 100644 index 79a10be..0000000 --- a/rushs/tinyprintf/handling_complex/complex.c +++ /dev/null @@ -1,51 +0,0 @@ -#include "complex.h" - -#include - -void print_complex(struct complex a) -{ - printf("complex(%.2f ", a.real); - - if (a.img < 0) - { - printf("- %.2fi", -a.img); - } - else - { - printf("+ %.2fi", a.img); - } - printf(")\n"); -} - -struct complex neg_complex(struct complex a) -{ - struct complex z = { -a.real, -a.img }; - return z; -} - -struct complex add_complex(struct complex a, struct complex b) -{ - struct complex z = { a.real + b.real, a.img + b.img }; - return z; -} - -struct complex sub_complex(struct complex a, struct complex b) -{ - return add_complex(a, neg_complex(b)); -} - -struct complex mul_complex(struct complex a, struct complex b) -{ - struct complex z = { a.real * b.real - a.img * b.img, - a.real * b.img + a.img * b.real }; - return z; -} - -struct complex div_complex(struct complex a, struct complex b) -{ - struct complex z = { - (a.real * b.real + a.img * b.img) / (b.real * b.real + b.img * b.img), - (a.img * b.real - a.real * b.img) / (b.real * b.real + b.img * b.img) - }; - return z; -} -- cgit v1.2.3