diff options
author | jofret | 2007-03-23 16:03:15 +0000 |
---|---|---|
committer | jofret | 2007-03-23 16:03:15 +0000 |
commit | 6e034d2dcf27cf7f078a5efe435105ee5cc731b3 (patch) | |
tree | cc248413621a027e47521a5f158573d122b9d3d6 | |
parent | 423b129433254f7c4e5c4a0be5730d0d1c5454ab (diff) | |
download | scilab2c-6e034d2dcf27cf7f078a5efe435105ee5cc731b3.tar.gz scilab2c-6e034d2dcf27cf7f078a5efe435105ee5cc731b3.tar.bz2 scilab2c-6e034d2dcf27cf7f078a5efe435105ee5cc731b3.zip |
Too tired... need rest :-S
-rw-r--r-- | src/type/Makefile.am | 4 | ||||
-rw-r--r-- | src/type/Makefile.in | 16 | ||||
-rw-r--r-- | src/type/doubleComplex.c | 4 | ||||
-rw-r--r-- | src/type/doubleComplex.h | 13 | ||||
-rw-r--r-- | src/type/floatComplex.c | 28 | ||||
-rw-r--r-- | src/type/floatComplex.h | 13 | ||||
-rw-r--r-- | src/type/testDoubleComplex.c | 6 | ||||
-rw-r--r-- | src/type/testFloatComplex.c | 13 |
8 files changed, 67 insertions, 30 deletions
diff --git a/src/type/Makefile.am b/src/type/Makefile.am index dde8532c..3d4a4b9e 100644 --- a/src/type/Makefile.am +++ b/src/type/Makefile.am @@ -5,12 +5,12 @@ ## Made by Bruno JOFRET <bruno.jofret@inria.fr> ## ## Started on Thu Nov 30 16:33:40 2006 jofret -## Last update Fri Mar 23 10:46:35 2007 jofret +## Last update Fri Mar 23 11:25:39 2007 jofret ## ## Copyright INRIA 2006 ## -instdir = $(topdir)/lib +instdir = $(top_builddir)/lib inst_LIBRARIES = libDoubleComplex.a libFloatComplex.a diff --git a/src/type/Makefile.in b/src/type/Makefile.in index 5e9a9c4f..7adbc223 100644 --- a/src/type/Makefile.in +++ b/src/type/Makefile.in @@ -40,8 +40,8 @@ check_PROGRAMS = testDoubleComplex$(EXEEXT) testFloatComplex$(EXEEXT) subdir = type DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -am__aclocal_m4_deps = $(top_srcdir)/m4/fftw.m4 \ - $(top_srcdir)/m4/fortran.m4 $(top_srcdir)/configure.ac +am__aclocal_m4_deps = $(top_srcdir)/m4/fortran.m4 \ + $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(install_sh) -d @@ -116,7 +116,6 @@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ F77 = @F77@ FFLAGS = @FFLAGS@ -FFTW3_LIB = @FFTW3_LIB@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ @@ -126,6 +125,9 @@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ +MAINT = @MAINT@ +MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@ +MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@ MAKEINFO = @MAKEINFO@ OBJEXT = @OBJEXT@ PACKAGE = @PACKAGE@ @@ -182,7 +184,7 @@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ -instdir = $(topdir)/lib +instdir = $(top_builddir)/lib inst_LIBRARIES = libDoubleComplex.a libFloatComplex.a noinst_LIBRARIES = libDoubleComplex.a libFloatComplex.a libDoubleComplex_a_SOURCES = $(DCHEAD) $(DCSRC) @@ -204,7 +206,7 @@ all: all-am .SUFFIXES: .SUFFIXES: .c .o .obj -$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) +$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ @@ -229,9 +231,9 @@ Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh -$(top_srcdir)/configure: $(am__configure_deps) +$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh -$(ACLOCAL_M4): $(am__aclocal_m4_deps) +$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh install-instLIBRARIES: $(inst_LIBRARIES) @$(NORMAL_INSTALL) diff --git a/src/type/doubleComplex.c b/src/type/doubleComplex.c index 61a6ef18..9884f417 100644 --- a/src/type/doubleComplex.c +++ b/src/type/doubleComplex.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 Feb 23 16:20:09 2007 jofret +** Last update Fri Mar 23 14:41:36 2007 jofret ** ** Copyright INRIA 2006 */ @@ -53,7 +53,7 @@ double zreals(doubleComplex z) { ** \brief Return a Complex Imaginary Part . */ double zimags(doubleComplex z) { - return creal(z); + return cimag(z); } diff --git a/src/type/doubleComplex.h b/src/type/doubleComplex.h index b062703e..5f2ce544 100644 --- a/src/type/doubleComplex.h +++ b/src/type/doubleComplex.h @@ -5,7 +5,7 @@ ** Made by Bruno JOFRET <bruno.jofret@inria.fr> ** ** Started on Thu Nov 30 16:50:08 2006 jofret -** Last update Tue Feb 27 10:02:08 2007 jofret +** Last update Fri Mar 23 16:59:54 2007 jofret ** ** Copyright INRIA 2006 */ @@ -13,6 +13,17 @@ #ifndef __DOUBLECOMPLEX_H__ #define __DOUBLECOMPLEX_H__ +#ifdef __STDC_VERSION__ +# ifndef STDC +# define STDC +# endif +# if __STDC_VERSION__ >= 199901L +# ifndef STDC99 +# define STDC99 +# endif +# endif +#endif + #include <stdbool.h> #ifndef STDC99 diff --git a/src/type/floatComplex.c b/src/type/floatComplex.c index 565bb6b2..340f62b0 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 Tue Feb 27 10:03:22 2007 jofret +** Last update Fri Mar 23 17:06:17 2007 jofret ** ** Copyright INRIA 2006 */ @@ -21,6 +21,7 @@ # endif #endif +#include <stdio.h> #include "floatComplex.h" #ifndef STDC99 @@ -45,7 +46,7 @@ float cimags(floatComplex z) { ** \brief Return a Complex Real Part . */ float creals(floatComplex z) { - return creal(z); + return crealf(z); } /* @@ -53,7 +54,7 @@ float creals(floatComplex z) { ** \brief Return a Complex Imaginary Part . */ float cimags(floatComplex z) { - return creal(z); + return cimagf(z); } #endif @@ -61,13 +62,22 @@ float cimags(floatComplex z) { ** \function FloatComplex ** \brief construct a Float Complex . */ -floatComplex FloatComplex(float real, float imag) { +floatComplex FloatComplex(float a, float b) { + printf("DEBUG : arg1 = %f \n", a); + printf("DEBUG : arg2 = %f \n", b); + floatComplex z; #ifndef STDC99 - z.real = real; - z.imag = imag; + printf("-*- Hand made Complex -*-\n"); + z.real = a; + z.imag = b; + printf("DEBUG : real = %f // %f\n", a, creals(z)); + printf("DEBUG : imag = %f // %f\n", b, cimags(z)); #else - z = real + I * imag; + printf("-*- C99 Complex -*-\n"); + z = a + I * b; + printf("DEBUG : real = %f // %f\n", a, crealf(z)); + printf("DEBUG : imag = %f // %f\n", b, cimagf(z)); #endif return z; } @@ -77,7 +87,7 @@ floatComplex FloatComplex(float real, float imag) { ** \brief check if complex is real . */ bool cisreals(floatComplex z) { - if (creals(z) == 0) + if (cimags(z) == 0) return true; return false; } @@ -87,7 +97,7 @@ bool cisreals(floatComplex z) { ** \brief check if complex is pure imaginary . */ bool cisimags(floatComplex z) { - if (cimags(z) == 0) + if (creals(z) == 0) return true; return false; } diff --git a/src/type/floatComplex.h b/src/type/floatComplex.h index dedd629d..0d85ca78 100644 --- a/src/type/floatComplex.h +++ b/src/type/floatComplex.h @@ -5,7 +5,7 @@ ** Made by Bruno JOFRET <bruno.jofret@inria.fr> ** ** Started on Thu Nov 30 16:50:08 2006 jofret -** Last update Tue Feb 27 09:58:29 2007 jofret +** Last update Fri Mar 23 17:01:43 2007 jofret ** ** Copyright INRIA 2006 */ @@ -13,6 +13,17 @@ #ifndef __FLOATCOMPLEX_H__ #define __FLOATCOMPLEX_H__ +#ifdef __STDC_VERSION__ +# ifndef STDC +# define STDC +# endif +# if __STDC_VERSION__ >= 199901L +# ifndef STDC99 +# define STDC99 +# endif +# endif +#endif + #include <stdbool.h> #ifndef STDC99 diff --git a/src/type/testDoubleComplex.c b/src/type/testDoubleComplex.c index 0823a39b..4dbefe4f 100644 --- a/src/type/testDoubleComplex.c +++ b/src/type/testDoubleComplex.c @@ -5,7 +5,7 @@ ** Made by Bruno JOFRET <bruno.jofret@inria.fr> ** ** Started on Thu Nov 30 16:59:04 2006 jofret -** Last update Fri Mar 23 11:11:25 2007 jofret +** Last update Fri Mar 23 14:39:45 2007 jofret ** ** Copyright INRIA 2006 */ @@ -18,9 +18,9 @@ int main(int argc, char **argv) { /* z = -3 + 25*%i */ doubleComplex z = DoubleComplex(-3,25); printf("Partie reelle = %f\n", zreals(z)); - assert(zreals(z) == -3); + assert(zreals(z) == (double)-3); printf("Partie imaginaire = %f\n", zimags(z)); - assert(zimags(z) == 25); + assert(zimags(z) == (double)25); /* z = -3.123456 + 25.123456*%i */ z = DoubleComplex(-3.123456,25.123456); diff --git a/src/type/testFloatComplex.c b/src/type/testFloatComplex.c index 869cca33..441de367 100644 --- a/src/type/testFloatComplex.c +++ b/src/type/testFloatComplex.c @@ -5,25 +5,28 @@ ** Made by Bruno JOFRET <bruno.jofret@inria.fr> ** ** Started on Thu Nov 30 16:59:04 2006 jofret -** Last update Fri Mar 23 11:10:37 2007 jofret +** Last update Fri Mar 23 17:05:00 2007 jofret ** ** Copyright INRIA 2006 */ #include <stdio.h> #include <assert.h> +#include <float.h> +#include <complex.h> #include "floatComplex.h" + int main(int argc, char **argv) { /* z = -3 + 25*%i */ - floatComplex z = FloatComplex(-3,25); + floatComplex z = FloatComplex((float)-3, (float)25); printf("Partie reelle = %f\n", creals(z)); - assert(creals(z) == -3); + assert(creals(z) == (float)-3.0); printf("Partie imaginaire = %f\n", cimags(z)); - assert(cimags(z) == 25); + assert(cimags(z) == (float)25); /* z = -3.123456 + 25.123456*%i */ - z = FloatComplex(-3.123456,25.123456); + z = FloatComplex((float)-3.123456,(float)25.123456); printf("Partie reelle = %f\n", creals(z)); assert(creals(z) == (float)-3.123456); printf("Partie imaginaire = %f\n", cimags(z)); |