diff options
author | jofret | 2008-09-09 12:05:20 +0000 |
---|---|---|
committer | jofret | 2008-09-09 12:05:20 +0000 |
commit | b92e3d00f07bb1816a8d85a5fc4d77099142597b (patch) | |
tree | a85a5b26d1f5f30a9aec975b559f69c093cf4e15 /src/type | |
parent | 0cc36687f566ad0470dc40c7240e41e641874243 (diff) | |
download | scilab2c-b92e3d00f07bb1816a8d85a5fc4d77099142597b.tar.gz scilab2c-b92e3d00f07bb1816a8d85a5fc4d77099142597b.tar.bz2 scilab2c-b92e3d00f07bb1816a8d85a5fc4d77099142597b.zip |
Remove addition and subtraction -> dedicated to operations module
Diffstat (limited to 'src/type')
-rw-r--r-- | src/type/doubleComplex.c | 24 | ||||
-rw-r--r-- | src/type/doubleComplex.h | 2 | ||||
-rw-r--r-- | src/type/floatComplex.c | 24 | ||||
-rw-r--r-- | src/type/floatComplex.h | 2 | ||||
-rw-r--r-- | src/type/testDoubleComplex.c | 61 | ||||
-rw-r--r-- | src/type/testFloatComplex.c | 62 |
6 files changed, 0 insertions, 175 deletions
diff --git a/src/type/doubleComplex.c b/src/type/doubleComplex.c index 46dfb188..6ef9deeb 100644 --- a/src/type/doubleComplex.c +++ b/src/type/doubleComplex.c @@ -139,30 +139,6 @@ bool zisimags(doubleComplex z) { */ /* -** \function zadds -** \brief add 2 Complex numbers. -*/ -doubleComplex zadds(doubleComplex z1, doubleComplex z2) { -#ifndef STDC99 - return DoubleComplex(z1.real + z2.real, z1.imag + z2.imag); -#else - return z1 + z2; -#endif -} - -/* -** \function zdiffs -** \brief diff 2 Complex numbers. -*/ -doubleComplex zdiffs(doubleComplex z1, doubleComplex z2) { -#ifndef STDC99 - return DoubleComplex(z1.real - z2.real, z1.imag - z2.imag); -#else - return z1 - z2; -#endif -} - -/* ** \function ztimess ** \brief Multiply 2 Complex numbers. */ diff --git a/src/type/doubleComplex.h b/src/type/doubleComplex.h index bf5b34f6..ce491b90 100644 --- a/src/type/doubleComplex.h +++ b/src/type/doubleComplex.h @@ -64,8 +64,6 @@ doubleComplex* DoubleComplexMatrix(double*, double*, int); bool zisreals(doubleComplex); bool zisimags(doubleComplex); -doubleComplex zadds(doubleComplex, doubleComplex); -doubleComplex zdiffs(doubleComplex, doubleComplex); doubleComplex ztimess(doubleComplex, doubleComplex); doubleComplex zdevides(doubleComplex, doubleComplex); #endif /* !__DOUBLECOMPLEX_H__ */ diff --git a/src/type/floatComplex.c b/src/type/floatComplex.c index af23cb98..09ae0159 100644 --- a/src/type/floatComplex.c +++ b/src/type/floatComplex.c @@ -141,30 +141,6 @@ bool cisimags(floatComplex z) { */ /* -** \function cadds -** \brief add 2 Complex numbers. -*/ -floatComplex cadds(floatComplex z1, floatComplex z2) { -#ifndef STDC99 - return FloatComplex(z1.real + z2.real, z1.imag + z2.imag); -#else - return z1 + z2; -#endif -} - -/* -** \function cdiffs -** \brief diff 2 Complex numbers. -*/ -floatComplex cdiffs(floatComplex z1, floatComplex z2) { -#ifndef STDC99 - return FloatComplex(z1.real - z2.real, z1.imag - z2.imag); -#else - return z1 - z2; -#endif -} - -/* ** \function ctimess ** \brief Multiply 2 Complex numbers. */ diff --git a/src/type/floatComplex.h b/src/type/floatComplex.h index e2197719..47a77899 100644 --- a/src/type/floatComplex.h +++ b/src/type/floatComplex.h @@ -64,8 +64,6 @@ floatComplex* FloatComplexMatrix(float*, float*, int); bool cisreals(floatComplex); bool cisimags(floatComplex); -floatComplex cadds(floatComplex, floatComplex); -floatComplex cdiffs(floatComplex, floatComplex); floatComplex ctimess(floatComplex, floatComplex); floatComplex cdevides(floatComplex, floatComplex); diff --git a/src/type/testDoubleComplex.c b/src/type/testDoubleComplex.c index ebfd8403..26e3416e 100644 --- a/src/type/testDoubleComplex.c +++ b/src/type/testDoubleComplex.c @@ -55,68 +55,7 @@ static int matrixCreation(void) { return 0; } -static int addAndDiff(void) { - /* z = -3 + 25*%i */ - doubleComplex z = DoubleComplex(3.0,-25.0); - /* y = -3.123456 + 25.123456*%i */ - doubleComplex y = DoubleComplex(-3.123456,25.123456); - /* t = z + y */ - doubleComplex t = zadds(z,y); - /* u = z - y */ - doubleComplex u = zdiffs(z,y); - - - /* z = -3 + 25*%i */ - printf("Partie reelle = %f\n", zreals(z)); - assert(zreals(z) == 3.0); - printf("Partie imaginaire = %f\n", zimags(z)); - assert(zimags(z) == -25.0); - - /* y = -3.123456 + 25.123456*%i */ - printf("Partie reelle = %f\n", zreals(y)); - assert(zreals(y) == -3.123456); - printf("Partie imaginaire = %f\n", zimags(y)); - assert(zimags(y) == 25.123456); - - /* Try to have somme addition */ - printf("Partie reelle = %f\n", zreals(t)); - assert(zreals(t) == 3.0 + -3.123456); - printf("Partie imaginaire = %f\n", zimags(t)); - assert(zimags(t) == -25.0 + 25.123456); - - /* Try to have somme diff */ - printf("Partie reelle = %f\n", zreals(u)); - assert(zreals(u) == 3.0 - -3.123456); - printf("Partie imaginaire = %f\n", zimags(u)); - assert(zimags(u) == -25.0 - 25.123456); - return 0; -} - -static int timesAndDevide(void) { - /* z1 = 1 + i */ - doubleComplex z1 = DoubleComplex(1.0, 1.0); - /* z2 = 2 + i */ - doubleComplex z2 = DoubleComplex(2.0, 1.0); - - doubleComplex z1_times_z2 = ztimess(z1, z2); - doubleComplex z1_devide_z2 = zdevides(z1, z2); - - /* z1 * z2 = 1 + 3i */ - printf("z1_times_z2 = %e + %ei\n", zreals(z1_times_z2), zimags(z1_times_z2)); - assert(zreals(z1_times_z2) == 1.0); - assert(zimags(z1_times_z2) == 3.0); - - /* z1 / z2 = 0.6 + 0.2i */ - printf("z1_devide_z2 = %e + %ei\n", zreals(z1_devide_z2), zimags(z1_devide_z2)); - assert(zreals(z1_devide_z2) == 0.6); - assert(zimags(z1_devide_z2) == 0.2); - - return 0; -} - int main(void) { matrixCreation(); - addAndDiff(); - timesAndDevide(); return 0; } diff --git a/src/type/testFloatComplex.c b/src/type/testFloatComplex.c index 779258fb..e6042d7c 100644 --- a/src/type/testFloatComplex.c +++ b/src/type/testFloatComplex.c @@ -57,69 +57,7 @@ static int matrixCreation(void) { return 0; } -static int addAndDiff(void) { - /* z = -3 + 25*%i */ - floatComplex z = FloatComplex((float)3, (float)-25); - /* y = -3.123456 + 25.123456*%i */ - floatComplex y = FloatComplex((float)-3.123,(float)25.123); - /* t = z + y */ - floatComplex t = cadds(z,y); - /* u = z - y */ - floatComplex u = cdiffs(z,y); - - - /* z = -3 + 25*%i */ - printf("Partie reelle = %f\n", creals(z)); - assert(creals(z) == (float)3); - printf("Partie imaginaire = %f\n", cimags(z)); - assert(cimags(z) == (float)-25); - - /* y = -3.123456 + 25.123456*%i */ - printf("Partie reelle = %f\n", creals(y)); - assert(creals(y) == (float)-3.123); - printf("Partie imaginaire = %f\n", cimags(y)); - assert(cimags(y) == (float)25.123); - - /* Try to have somme addition */ - printf("Partie reelle = %f\n", creals(t)); - assert(creals(t) == (float)3 + (float)-3.123); - printf("Partie imaginaire = %f\n", cimags(t)); - assert(cimags(t) == (float)-25 + (float)25.123); - - /* Try to have somme diff */ - printf("Partie reelle = %f\n", creals(u)); - assert(creals(u) == (float)3 - (float)-3.123); - printf("Partie imaginaire = %f\n", cimags(u)); - assert(cimags(u) == (float)-25 - (float)25.123); - - return 0; -} - -static int timesAndDevide(void) { - /* z1 = 1 + i */ - floatComplex z1 = FloatComplex(1.0f, 1.0f); - /* z2 = 2 + i */ - floatComplex z2 = FloatComplex(2.0f, 1.0f); - - floatComplex z1_times_z2 = ctimess(z1, z2); - floatComplex z1_devide_z2 = cdevides(z1, z2); - - /* z1 * z2 = 1 + 3i */ - printf("z1_times_z2 = %e + %ei\n", creals(z1_times_z2), cimags(z1_times_z2)); - assert(creals(z1_times_z2) == 1.0f); - assert(cimags(z1_times_z2) == 3.0f); - - /* z1 / z2 = 0.6 + 0.2i */ - printf("z1_devide_z2 = %e + %ei\n", creals(z1_devide_z2), cimags(z1_devide_z2)); - assert(creals(z1_devide_z2) == 0.6f); - assert(cimags(z1_devide_z2) == 0.2f); - - return 0; -} - int main(void) { matrixCreation(); - addAndDiff(); - timesAndDevide(); return 0; } |