/*************************************************************************************************************************************/ /* */ /* T E S T D E S O U T I L S " F O L K L O R I Q U E S " P O U R L E S N O M B R E S C O M P L E X E S : */ /* */ /* */ /* Author of '$xtc/OperationsFolkoriquesComplexes.02$vv$c' : */ /* */ /* Jean-Francois COLONNA (LACTAMME, 20220823095351). */ /* */ /*************************************************************************************************************************************/ #include <stdio.h> double a1111=0; double a1110=0; double a1101=0; double a1100=0; double a1011=0; double a1010=0; double a1001=0; double a1000=0; double a0111=0; double a0110=0; double a0101=0; double a0100=0; double a0011=0; double a0010=0; double a0001=0; double a0000=0; #define p_I2xR2xI1xR1 \ a1111 #define p_I2xR2xI1 \ a1110 #define p_I2xR2xR1 \ a1101 #define p_I2xR2 \ a1100 #define p_I2xI1xR1 \ a1011 #define p_I2xI1 \ a1010 #define p_I2xR1 \ a1001 #define p_I2 \ a1000 #define p_R2xI1xR1 \ a0111 #define p_R2xI1 \ a0110 #define p_R2xR1 \ a0101 #define p_R2 \ a0100 #define p_I1xR1 \ a0011 #define p_I1 \ a0010 #define p_R1 \ a0001 #define p_ \ a0000 #define REINITIALISATION \ { \ a1111=0; \ a1110=0; \ a1101=0; \ a1100=0; \ a1011=0; \ a1010=0; \ a1001=0; \ a1000=0; \ a0111=0; \ a0110=0; \ a0101=0; \ a0100=0; \ a0011=0; \ a0010=0; \ a0001=0; \ a0000=0; \ } #define FORME_COMPLETE \ ((((((((((((((((((((a1111)) \ *(R1)))+(a1110)))) \ *(I1)))+((((((a1101))*(R1))) \ +(a1100))))))*(R2))) \ +(((((((((((a1011))*(R1))) \ +(a1010))))*(I1)))+((((((a1001)) \ *(R1)))+(a1000))))))))*(I2))) \ +((((((((((((((((a0111)) \ *(R1)))+(a0110))))*(I1))) \ +((((((a0101))*(R1))) \ +(a0100))))))*(R2)))+(((((((((((a0011)) \ *(R1))) \ +(a0010)))) \ *(I1)))+((((((a0001))*(R1))) \ +(a0000)))))))) #define R \ R1 #define I \ I1 #define r \ R2 #define i \ I2 #define PRINT(code,valeur) \ { \ printf(" R1=%.0f I1=%.0f R2=%.0f I2=%.0f",R1,I1,R2,I2); \ printf(" F_COMPLETE=%.0f",FORME_COMPLETE); \ printf(" ValeurAttendue=%.0f",(double)valeur); \ printf(" %s",code); \ \ if (valeur != FORME_COMPLETE) \ { \ printf(" ERREUR"); \ } \ else \ { \ } \ \ printf("\n"); \ REINITIALISATION; \ } main() { double R1=2,I1=3; double R2=5,I2=7; /* L'usage des nombres premiers {2,3,5,7} permet d'identifier sans ambiguite les */ /* facteurs d'un produit... */ p_I2xR2xI1xR1=+1 ; PRINT("p_I2xR2xI1xR1",I2*R2*I1*R1); p_I2xR2xI1=+1 ; PRINT("p_I2xR2xI1",I2*R2*I1); p_I2xI1xR1=+1 ; PRINT("p_I2xI1xR1",I2*I1*R1); p_I2xI1=+1 ; PRINT("p_I2xI1",I2*I1); p_I2xR2xR1=+1 ; PRINT("p_I2xR2xR1",I2*R2*R1); p_I2xR2=+1 ; PRINT("p_I2xR2",I2*R2); p_I2xR1=+1 ; PRINT("p_I2xR1",I2*R1); p_I2=+1 ; PRINT("p_I2",I2); p_R2xI1xR1=+1 ; PRINT("p_R2xI1xR1",R2*I1*R1); p_R2xI1=+1 ; PRINT("p_R2xI1",R2*I1); p_I1xR1=+1 ; PRINT("p_I1xR1",I1*R1); p_I1=+1 ; PRINT("p_I1",I1); p_R2xR1=+1 ; PRINT("p_R2xR1",R2*R1); p_R2=+1 ; PRINT("p_R2",R2); p_R1=+1 ; PRINT("p_R1",R1); p_=+1 ; PRINT("p_",1); printf("\n"); p_R1=+1 ; p_R2=+1 ; PRINT("p_R1,p_R2",R1+R2); p_I1=+1 ; p_I2=+1 ; PRINT("p_I1,p_I2",I1+I2); p_R2xR1=+1 ; p_I2xI1=-1 ; PRINT("p_R2xR1,p_I2xI1",(R2*R1)-(I2*I1)); p_R2xI1=+1 ; p_I2xR1=+1 ; PRINT("p_R2xI1,p_I2xR1",(R2*I1)+(I2*R1)); p_I2xR2xI1xR1=+1 ; p_I2xR2xI1=+1 ; p_I2xI1xR1=+1 ; p_I2xR2xR1=+1 ; p_R2xI1xR1=+1 ; PRINT("p_I2xR2xI1xR1,p_I2xR2xI1,p_I2xI1xR1,p_I2xR2xR1,p_R2xI1xR1",(I2*R2*I1*R1)+(I2*R2*I1)+(I2*I1*R1)+(I2*R2*R1)+(R2*I1*R1)); }