diff options
author | jofret | 2006-12-07 14:01:57 +0000 |
---|---|---|
committer | jofret | 2006-12-07 14:01:57 +0000 |
commit | fadf00bef97c95feba926fef17ed85a4ba8db727 (patch) | |
tree | 9b237ce91286f9bbcdd9c6106839230b45b9fad0 /src | |
parent | aea460b1921614092539424b0633318617857ce7 (diff) | |
download | scilab2c-fadf00bef97c95feba926fef17ed85a4ba8db727.tar.gz scilab2c-fadf00bef97c95feba926fef17ed85a4ba8db727.tar.bz2 scilab2c-fadf00bef97c95feba926fef17ed85a4ba8db727.zip |
float complex structure
Diffstat (limited to 'src')
-rw-r--r-- | src/type/floatComplex.c | 60 | ||||
-rw-r--r-- | src/type/floatComplex.h | 32 |
2 files changed, 92 insertions, 0 deletions
diff --git a/src/type/floatComplex.c b/src/type/floatComplex.c new file mode 100644 index 00000000..eecc3a8e --- /dev/null +++ b/src/type/floatComplex.c @@ -0,0 +1,60 @@ +/* +** -*- C -*- +** +** floatComplex.c +** Made by Bruno JOFRET <bruno.jofret@inria.fr> +** +** Started on Thu Nov 30 16:27:08 2006 jofret +** Last update Thu Dec 7 11:44:05 2006 jofret +** +** Copyright INRIA 2006 +*/ + +#include "floatComplex.h" + +/* +** \function real +** \brief Return a Complex Real Part . +*/ +float real(floatComplex z) { + return z.real; +} + +/* +** \function imag +** \brief Return a Complex Imaginary Part . +*/ +float imag(floatComplex z) { + return z.imag; +} + +/* +** \function FloatComplex +** \brief construct a Float Complex . +*/ +floatComplex FloatComplex(float real, float imag) { + floatComplex z; + z.real = real; + z.imag = imag; + return z; +} + +/* +** \function isreal +** \brief check if complex is real . +*/ +bool isreal(floatComplex z) { + if (z.imag == 0) + return true; + return false; +} + +/* +** \function isimag +** \brief check if complex is pure imaginary . +*/ +bool isimag(floatComplex z) { + if (z.real == 0) + return true; + return false; +} diff --git a/src/type/floatComplex.h b/src/type/floatComplex.h new file mode 100644 index 00000000..aa2aab04 --- /dev/null +++ b/src/type/floatComplex.h @@ -0,0 +1,32 @@ +/* +** -*- C -*- +** +** floatComplex.h +** Made by Bruno JOFRET <bruno.jofret@inria.fr> +** +** Started on Thu Nov 30 16:50:08 2006 jofret +** Last update Thu Dec 7 11:44:08 2006 jofret +** +** Copyright INRIA 2006 +*/ + +#ifndef __FLOATCOMPLEX_H__ +#define __FLOATCOMPLEX_H__ + +#include <stdbool.h> + +struct float_complex +{ + float real; + float imag; +}; + +typedef struct float_complex floatComplex; + +float real(floatComplex); +float imag(floatComplex); +floatComplex FloatComplex(float, float); +bool isreal(floatComplex); +bool isimag(floatComplex); + +#endif /* !__FLOATCOMPLEX_H__ */ |