summaryrefslogtreecommitdiff
path: root/src/type
diff options
context:
space:
mode:
authorjofret2007-10-22 15:27:58 +0000
committerjofret2007-10-22 15:27:58 +0000
commit4156576b3b0e040d8564db7622826f22bd67bbe8 (patch)
tree922935b267f5dc6ca9f8e01f1fdcf5a576cc6f19 /src/type
parent9abdd47800ebd9b2c45f078338e9adabecf74f5a (diff)
downloadscilab2c-4156576b3b0e040d8564db7622826f22bd67bbe8.tar.gz
scilab2c-4156576b3b0e040d8564db7622826f22bd67bbe8.tar.bz2
scilab2c-4156576b3b0e040d8564db7622826f22bd67bbe8.zip
Add some floatComplex operators
Diffstat (limited to 'src/type')
-rw-r--r--src/type/floatComplex.c51
1 files changed, 50 insertions, 1 deletions
diff --git a/src/type/floatComplex.c b/src/type/floatComplex.c
index eb1487d0..a5483161 100644
--- a/src/type/floatComplex.c
+++ b/src/type/floatComplex.c
@@ -5,7 +5,7 @@
** Made by Bruno JOFRET <bruno.jofret@inria.fr>
**
** Started on Thu Nov 30 16:27:08 2006 jofret
-** Last update Fri Apr 20 11:03:44 2007 jofret
+** Last update Thu Aug 30 09:42:59 2007 bruno
**
** Copyright INRIA 2006
*/
@@ -92,3 +92,52 @@ bool cisimags(floatComplex z) {
return true;
return false;
}
+
+/*
+** Operators
+** {
+*/
+
+/*
+** \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.
+*/
+floatComplex ctimess(floatComplex z1, floatComplex z2) {
+#ifndef STDC99
+ return FloatComplex(z1.real*z2.real - z1.imag*z2.imag,
+ z1.real*z2.imag + z2.real*z1.imag);
+#else
+ return z1 * z2;
+#endif
+}
+
+
+
+
+/*
+** }
+*/