summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjofret2008-04-18 09:10:33 +0000
committerjofret2008-04-18 09:10:33 +0000
commitf7ae4cce0bc844b137ccce135578c2248a6642b1 (patch)
tree1a4aaf9f51470a78f95733615d0f19045737f8ac
parente15d2967125c1663ca83ec8ddb0bc23e481fef52 (diff)
downloadscilab2c-f7ae4cce0bc844b137ccce135578c2248a6642b1.tar.gz
scilab2c-f7ae4cce0bc844b137ccce135578c2248a6642b1.tar.bz2
scilab2c-f7ae4cce0bc844b137ccce135578c2248a6642b1.zip
Double vs Float better management. Enable psycho warnings.
-rw-r--r--src/elementaryFunctions/cos/Makefile.am26
-rw-r--r--src/elementaryFunctions/cos/Makefile.in93
-rw-r--r--src/elementaryFunctions/cos/ccoss.c20
-rw-r--r--src/elementaryFunctions/cos/scoss.c22
-rw-r--r--src/elementaryFunctions/cos/testCos.c152
-rw-r--r--src/elementaryFunctions/cos/testCos.h20
-rw-r--r--src/elementaryFunctions/cos/testDoubleCos.c88
-rw-r--r--src/elementaryFunctions/cos/testFloatCos.c87
8 files changed, 284 insertions, 224 deletions
diff --git a/src/elementaryFunctions/cos/Makefile.am b/src/elementaryFunctions/cos/Makefile.am
index 43ec1282..362c1fe4 100644
--- a/src/elementaryFunctions/cos/Makefile.am
+++ b/src/elementaryFunctions/cos/Makefile.am
@@ -37,19 +37,25 @@ HEAD = ../includes/cos.h
check_INCLUDES = -I $(top_builddir)/elementaryFunctions/includes \
-I $(top_builddir)/type
-check_PROGRAMS = testCos
-
-TESTS = testCos
-
-#
-# -*- Cosine Tests -*-
-#
-testCos_SOURCES = testCos.c
-testCos_CFLAGS = $(check_INCLUDES)
-testCos_LDADD = $(top_builddir)/type/libDoubleComplex.la \
+check_LDADD = $(top_builddir)/type/libDoubleComplex.la \
$(top_builddir)/type/libFloatComplex.la \
$(top_builddir)/elementaryFunctions/cos/libCos.la \
$(top_builddir)/elementaryFunctions/sin/libSin.la \
$(top_builddir)/elementaryFunctions/cosh/libCosh.la \
$(top_builddir)/elementaryFunctions/sinh/libSinh.la \
@LIBMATH@
+
+check_PROGRAMS = testFloatCos testDoubleCos
+
+TESTS = testFloatCos testDoubleCos
+
+#
+# -*- Cosine Tests -*-
+#
+testFloatCos_SOURCES = testFloatCos.c
+testFloatCos_CFLAGS = $(check_INCLUDES)
+testFloatCos_LDADD = $(check_LDADD)
+
+testDoubleCos_SOURCES = testDoubleCos.c
+testDoubleCos_CFLAGS = $(check_INCLUDES)
+testDoubleCos_LDADD = $(check_LDADD) \ No newline at end of file
diff --git a/src/elementaryFunctions/cos/Makefile.in b/src/elementaryFunctions/cos/Makefile.in
index cc486bd5..774031a8 100644
--- a/src/elementaryFunctions/cos/Makefile.in
+++ b/src/elementaryFunctions/cos/Makefile.in
@@ -32,8 +32,8 @@ PRE_UNINSTALL = :
POST_UNINSTALL = :
build_triplet = @build@
host_triplet = @host@
-check_PROGRAMS = testCos$(EXEEXT)
-TESTS = testCos$(EXEEXT)
+check_PROGRAMS = testFloatCos$(EXEEXT) testDoubleCos$(EXEEXT)
+TESTS = testFloatCos$(EXEEXT) testDoubleCos$(EXEEXT)
subdir = elementaryFunctions/cos
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
@@ -62,17 +62,24 @@ libCos_la_OBJECTS = $(am_libCos_la_OBJECTS)
libCos_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
$(LIBTOOLFLAGS) --mode=link $(CCLD) $(libCos_la_CFLAGS) \
$(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
-am_testCos_OBJECTS = testCos-testCos.$(OBJEXT)
-testCos_OBJECTS = $(am_testCos_OBJECTS)
-testCos_DEPENDENCIES = $(top_builddir)/type/libDoubleComplex.la \
+am_testDoubleCos_OBJECTS = testDoubleCos-testDoubleCos.$(OBJEXT)
+testDoubleCos_OBJECTS = $(am_testDoubleCos_OBJECTS)
+am__DEPENDENCIES_1 = $(top_builddir)/type/libDoubleComplex.la \
$(top_builddir)/type/libFloatComplex.la \
$(top_builddir)/elementaryFunctions/cos/libCos.la \
$(top_builddir)/elementaryFunctions/sin/libSin.la \
$(top_builddir)/elementaryFunctions/cosh/libCosh.la \
$(top_builddir)/elementaryFunctions/sinh/libSinh.la
-testCos_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
- --mode=link $(CCLD) $(testCos_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \
- $(LDFLAGS) -o $@
+testDoubleCos_DEPENDENCIES = $(am__DEPENDENCIES_1)
+testDoubleCos_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
+ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(testDoubleCos_CFLAGS) \
+ $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
+am_testFloatCos_OBJECTS = testFloatCos-testFloatCos.$(OBJEXT)
+testFloatCos_OBJECTS = $(am_testFloatCos_OBJECTS)
+testFloatCos_DEPENDENCIES = $(am__DEPENDENCIES_1)
+testFloatCos_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
+ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(testFloatCos_CFLAGS) \
+ $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
DEFAULT_INCLUDES = -I. -I$(top_builddir)/includes@am__isrc@
depcomp = $(SHELL) $(top_srcdir)/config/depcomp
am__depfiles_maybe = depfiles
@@ -85,8 +92,10 @@ CCLD = $(CC)
LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
--mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \
$(LDFLAGS) -o $@
-SOURCES = $(libCos_la_SOURCES) $(testCos_SOURCES)
-DIST_SOURCES = $(libCos_la_SOURCES) $(testCos_SOURCES)
+SOURCES = $(libCos_la_SOURCES) $(testDoubleCos_SOURCES) \
+ $(testFloatCos_SOURCES)
+DIST_SOURCES = $(libCos_la_SOURCES) $(testDoubleCos_SOURCES) \
+ $(testFloatCos_SOURCES)
ETAGS = etags
CTAGS = ctags
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
@@ -221,13 +230,7 @@ HEAD = ../includes/cos.h
check_INCLUDES = -I $(top_builddir)/elementaryFunctions/includes \
-I $(top_builddir)/type
-
-#
-# -*- Cosine Tests -*-
-#
-testCos_SOURCES = testCos.c
-testCos_CFLAGS = $(check_INCLUDES)
-testCos_LDADD = $(top_builddir)/type/libDoubleComplex.la \
+check_LDADD = $(top_builddir)/type/libDoubleComplex.la \
$(top_builddir)/type/libFloatComplex.la \
$(top_builddir)/elementaryFunctions/cos/libCos.la \
$(top_builddir)/elementaryFunctions/sin/libSin.la \
@@ -235,6 +238,16 @@ testCos_LDADD = $(top_builddir)/type/libDoubleComplex.la \
$(top_builddir)/elementaryFunctions/sinh/libSinh.la \
@LIBMATH@
+
+#
+# -*- Cosine Tests -*-
+#
+testFloatCos_SOURCES = testFloatCos.c
+testFloatCos_CFLAGS = $(check_INCLUDES)
+testFloatCos_LDADD = $(check_LDADD)
+testDoubleCos_SOURCES = testDoubleCos.c
+testDoubleCos_CFLAGS = $(check_INCLUDES)
+testDoubleCos_LDADD = $(check_LDADD)
all: all-am
.SUFFIXES:
@@ -304,9 +317,12 @@ clean-checkPROGRAMS:
echo " rm -f $$p $$f"; \
rm -f $$p $$f ; \
done
-testCos$(EXEEXT): $(testCos_OBJECTS) $(testCos_DEPENDENCIES)
- @rm -f testCos$(EXEEXT)
- $(testCos_LINK) $(testCos_OBJECTS) $(testCos_LDADD) $(LIBS)
+testDoubleCos$(EXEEXT): $(testDoubleCos_OBJECTS) $(testDoubleCos_DEPENDENCIES)
+ @rm -f testDoubleCos$(EXEEXT)
+ $(testDoubleCos_LINK) $(testDoubleCos_OBJECTS) $(testDoubleCos_LDADD) $(LIBS)
+testFloatCos$(EXEEXT): $(testFloatCos_OBJECTS) $(testFloatCos_DEPENDENCIES)
+ @rm -f testFloatCos$(EXEEXT)
+ $(testFloatCos_LINK) $(testFloatCos_OBJECTS) $(testFloatCos_LDADD) $(LIBS)
mostlyclean-compile:
-rm -f *.$(OBJEXT)
@@ -322,7 +338,8 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libCos_la-scoss.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libCos_la-zcosa.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libCos_la-zcoss.Plo@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/testCos-testCos.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/testDoubleCos-testDoubleCos.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/testFloatCos-testFloatCos.Po@am__quote@
.c.o:
@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
@@ -401,19 +418,33 @@ libCos_la-zcosa.lo: zcosa.c
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libCos_la_CFLAGS) $(CFLAGS) -c -o libCos_la-zcosa.lo `test -f 'zcosa.c' || echo '$(srcdir)/'`zcosa.c
-testCos-testCos.o: testCos.c
-@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(testCos_CFLAGS) $(CFLAGS) -MT testCos-testCos.o -MD -MP -MF $(DEPDIR)/testCos-testCos.Tpo -c -o testCos-testCos.o `test -f 'testCos.c' || echo '$(srcdir)/'`testCos.c
-@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/testCos-testCos.Tpo $(DEPDIR)/testCos-testCos.Po
-@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='testCos.c' object='testCos-testCos.o' libtool=no @AMDEPBACKSLASH@
+testDoubleCos-testDoubleCos.o: testDoubleCos.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(testDoubleCos_CFLAGS) $(CFLAGS) -MT testDoubleCos-testDoubleCos.o -MD -MP -MF $(DEPDIR)/testDoubleCos-testDoubleCos.Tpo -c -o testDoubleCos-testDoubleCos.o `test -f 'testDoubleCos.c' || echo '$(srcdir)/'`testDoubleCos.c
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/testDoubleCos-testDoubleCos.Tpo $(DEPDIR)/testDoubleCos-testDoubleCos.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='testDoubleCos.c' object='testDoubleCos-testDoubleCos.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(testDoubleCos_CFLAGS) $(CFLAGS) -c -o testDoubleCos-testDoubleCos.o `test -f 'testDoubleCos.c' || echo '$(srcdir)/'`testDoubleCos.c
+
+testDoubleCos-testDoubleCos.obj: testDoubleCos.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(testDoubleCos_CFLAGS) $(CFLAGS) -MT testDoubleCos-testDoubleCos.obj -MD -MP -MF $(DEPDIR)/testDoubleCos-testDoubleCos.Tpo -c -o testDoubleCos-testDoubleCos.obj `if test -f 'testDoubleCos.c'; then $(CYGPATH_W) 'testDoubleCos.c'; else $(CYGPATH_W) '$(srcdir)/testDoubleCos.c'; fi`
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/testDoubleCos-testDoubleCos.Tpo $(DEPDIR)/testDoubleCos-testDoubleCos.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='testDoubleCos.c' object='testDoubleCos-testDoubleCos.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(testDoubleCos_CFLAGS) $(CFLAGS) -c -o testDoubleCos-testDoubleCos.obj `if test -f 'testDoubleCos.c'; then $(CYGPATH_W) 'testDoubleCos.c'; else $(CYGPATH_W) '$(srcdir)/testDoubleCos.c'; fi`
+
+testFloatCos-testFloatCos.o: testFloatCos.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(testFloatCos_CFLAGS) $(CFLAGS) -MT testFloatCos-testFloatCos.o -MD -MP -MF $(DEPDIR)/testFloatCos-testFloatCos.Tpo -c -o testFloatCos-testFloatCos.o `test -f 'testFloatCos.c' || echo '$(srcdir)/'`testFloatCos.c
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/testFloatCos-testFloatCos.Tpo $(DEPDIR)/testFloatCos-testFloatCos.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='testFloatCos.c' object='testFloatCos-testFloatCos.o' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(testCos_CFLAGS) $(CFLAGS) -c -o testCos-testCos.o `test -f 'testCos.c' || echo '$(srcdir)/'`testCos.c
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(testFloatCos_CFLAGS) $(CFLAGS) -c -o testFloatCos-testFloatCos.o `test -f 'testFloatCos.c' || echo '$(srcdir)/'`testFloatCos.c
-testCos-testCos.obj: testCos.c
-@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(testCos_CFLAGS) $(CFLAGS) -MT testCos-testCos.obj -MD -MP -MF $(DEPDIR)/testCos-testCos.Tpo -c -o testCos-testCos.obj `if test -f 'testCos.c'; then $(CYGPATH_W) 'testCos.c'; else $(CYGPATH_W) '$(srcdir)/testCos.c'; fi`
-@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/testCos-testCos.Tpo $(DEPDIR)/testCos-testCos.Po
-@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='testCos.c' object='testCos-testCos.obj' libtool=no @AMDEPBACKSLASH@
+testFloatCos-testFloatCos.obj: testFloatCos.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(testFloatCos_CFLAGS) $(CFLAGS) -MT testFloatCos-testFloatCos.obj -MD -MP -MF $(DEPDIR)/testFloatCos-testFloatCos.Tpo -c -o testFloatCos-testFloatCos.obj `if test -f 'testFloatCos.c'; then $(CYGPATH_W) 'testFloatCos.c'; else $(CYGPATH_W) '$(srcdir)/testFloatCos.c'; fi`
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/testFloatCos-testFloatCos.Tpo $(DEPDIR)/testFloatCos-testFloatCos.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='testFloatCos.c' object='testFloatCos-testFloatCos.obj' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(testCos_CFLAGS) $(CFLAGS) -c -o testCos-testCos.obj `if test -f 'testCos.c'; then $(CYGPATH_W) 'testCos.c'; else $(CYGPATH_W) '$(srcdir)/testCos.c'; fi`
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(testFloatCos_CFLAGS) $(CFLAGS) -c -o testFloatCos-testFloatCos.obj `if test -f 'testFloatCos.c'; then $(CYGPATH_W) 'testFloatCos.c'; else $(CYGPATH_W) '$(srcdir)/testFloatCos.c'; fi`
mostlyclean-libtool:
-rm -f *.lo
diff --git a/src/elementaryFunctions/cos/ccoss.c b/src/elementaryFunctions/cos/ccoss.c
index 66d73129..cee27a6e 100644
--- a/src/elementaryFunctions/cos/ccoss.c
+++ b/src/elementaryFunctions/cos/ccoss.c
@@ -1,14 +1,14 @@
/*
-** -*- C -*-
-**
-** ccoss.c
-** Made by Bruno JOFRET <bruno.jofret@inria.fr>
-**
-** Started on Thu Dec 7 12:04:28 2006 jofret
-** Last update Fri Feb 23 16:35:12 2007 jofret
-**
-** Copyright INRIA 2006
-*/
+ * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+ * Copyright (C) 2008-2008 - INRIA - Bruno JOFRET
+ *
+ * This file must be used under the terms of the CeCILL.
+ * This source file is licensed as described in the file COPYING, which
+ * you should have received as part of this distribution. The terms
+ * are also available at
+ * http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt
+ *
+ */
#include "cos.h"
#include "sin.h"
diff --git a/src/elementaryFunctions/cos/scoss.c b/src/elementaryFunctions/cos/scoss.c
index 9ecee026..9a3ca059 100644
--- a/src/elementaryFunctions/cos/scoss.c
+++ b/src/elementaryFunctions/cos/scoss.c
@@ -1,18 +1,18 @@
/*
-** -*- C -*-
-**
-** scoss.c
-** Made by Bruno JOFRET <bruno.jofret@inria.fr>
-**
-** Started on Thu Dec 7 11:05:37 2006 jofret
-** Last update Fri Apr 20 14:36:40 2007 jofret
-**
-** Copyright INRIA 2006
-*/
+ * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+ * Copyright (C) 2008-2008 - INRIA - Bruno JOFRET
+ *
+ * This file must be used under the terms of the CeCILL.
+ * This source file is licensed as described in the file COPYING, which
+ * you should have received as part of this distribution. The terms
+ * are also available at
+ * http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt
+ *
+ */
#include <math.h>
#include "cos.h"
float scoss(float x) {
- return (cos(x));
+ return (cosf(x));
}
diff --git a/src/elementaryFunctions/cos/testCos.c b/src/elementaryFunctions/cos/testCos.c
deleted file mode 100644
index 583908dd..00000000
--- a/src/elementaryFunctions/cos/testCos.c
+++ /dev/null
@@ -1,152 +0,0 @@
-/*
-** -*- C -*-
-**
-** testCos.c
-** Made by Bruno JOFRET <bruno.jofret@inria.fr>
-**
-** Started on Fri Dec 8 15:05:44 2006 jofret
-** Last update Mon Oct 22 11:36:49 2007 bruno
-**
-** Copyright INRIA 2006
-*/
-
-#include "testCos.h"
-
-void scossTest(void) {
- printf(">> Float scalar\n");
- printf("scoss(0) = %f\n", scoss((float) 0));
- printf("scoss(PI) = %f\n", scoss(PI));
- printf("scoss(PI/2) = %f\n", scoss(PI/2));
- printf("scoss(PI/3) = %f\n", scoss(PI/3));
- printf("scoss(PI/4) = %f\n", scoss(PI/4));
- printf("scoss(PI/6) = %f\n", scoss(PI/6));
- printf("scoss(-PI) = %f\n", scoss(-PI));
- printf("scoss(-PI/2) = %f\n", scoss(-PI/2));
- printf("scoss(-PI/3) = %f\n", scoss(-PI/3));
- printf("scoss(-PI/4) = %f\n", scoss(-PI/4));
- printf("scoss(-PI/6) = %f\n", scoss(-PI/6));
-}
-
-void dcossTest(void) {
- printf(">> Double scalar\n");
- printf("dcoss(0) = %e\n", dcoss((double) 0));
- printf("dcoss(PI) = %e\n", dcoss(PI));
- printf("dcoss(PI/2) = %e\n", dcoss(PI/2));
- printf("dcoss(PI/3) = %e\n", dcoss(PI/3));
- printf("dcoss(PI/4) = %e\n", dcoss(PI/4));
- printf("dcoss(PI/6) = %e\n", dcoss(PI/6));
- printf("dcoss(-PI) = %e\n", dcoss(-PI));
- printf("dcoss(-PI/2) = %e\n", dcoss(-PI/2));
- printf("dcoss(-PI/3) = %e\n", dcoss(-PI/3));
- printf("dcoss(-PI/4) = %e\n", dcoss(-PI/4));
- printf("dcoss(-PI/6) = %e\n", dcoss(-PI/6));
-}
-
-void ccossTest(void) {
- floatComplex pi_pi = FloatComplex(PI, PI);
- floatComplex pi_2_pi_2 = FloatComplex(PI/2, PI/2);
- floatComplex pi_2_pi_3 = FloatComplex(PI/2, PI/3);
- floatComplex pi_2_pi_4 = FloatComplex(PI/2, PI/4);
- floatComplex out;
-
- printf(">> Float Complex scalar\n");
- out = ccoss(pi_pi);
- printf("ccoss(PI + I*PI) = %f + I * %f\n", creals(out), cimags(out));
- out = ccoss(pi_2_pi_2);
- printf("ccoss(PI/2 + I*PI/2) = %f + I * %f\n", creals(out), cimags(out));
- out = ccoss(pi_2_pi_3);
- printf("ccoss(PI/2 + I*PI/3) = %f + I * %f\n", creals(out), cimags(out));
- out = ccoss(pi_2_pi_4);
- printf("ccoss(PI/2 + I*PI/4) = %f + I * %f\n", creals(out), cimags(out));
-}
-
-void zcossTest(void) {
- doubleComplex pi_pi = DoubleComplex(PI, PI);
- doubleComplex pi_2_pi_2 = DoubleComplex(PI/2, PI/2);
- doubleComplex pi_2_pi_3 = DoubleComplex(PI/2, PI/3);
- doubleComplex pi_2_pi_4 = DoubleComplex(PI/2, PI/4);
- doubleComplex out;
-
- printf(">> Double Complex scalar\n");
- out = zcoss(pi_pi);
- printf("zcoss(PI + I*PI) = %e + I * %e\n", zreals(out), zimags(out));
- out = zcoss(pi_2_pi_2);
- printf("zcoss(PI/2 + I*PI/2) = %e + I * %e\n", zreals(out), zimags(out));
- out = zcoss(pi_2_pi_3);
- printf("zcoss(PI/2 + I*PI/3) = %e + I * %e\n", zreals(out), zimags(out));
- out = zcoss(pi_2_pi_4);
- printf("zcoss(PI/2 + I*PI/4) = %e + I * %e\n", zreals(out), zimags(out));
-}
-
-void scosaTest(void) {
- float out[5];
- float in[5] = {PI, PI/2, PI/3, PI/4, PI/6};
- int i = 0;
-
- printf(">> Float array\n");
- scosa(in, 5, out);
- for (i = 0 ; i < 5 ; ++i)
- printf("scosa(array) = %f\n", out[i]);
-}
-
-void dcosaTest(void) {
- double out[5];
- double in[5] = {PI, PI/2, PI/3, PI/4, PI/6};
- int i = 0;
-
- printf(">> Double Array\n");
- dcosa(in, 5, out);
- for (i = 0 ; i < 5 ; ++i)
- printf("scosa(array) = %f\n", out[i]);
-
-}
-
-void ccosaTest(void) {
- floatComplex in[4];
- floatComplex out[4];
- int i = 0;
-
- in[0] = FloatComplex(PI, PI);
- in[1] = FloatComplex(PI/2, PI/2);
- in[2] = FloatComplex(PI/2, PI/3);
- in[3] = FloatComplex(PI/2, PI/4);
-
- ccosa(in, 4, out);
- printf(">> Float Complex Array\n");
- for (i = 0 ; i < 4 ; ++i)
- printf("ccosa(array) = %e + I * %e\n", creals(out[i]), cimags(out[i]));
-}
-
-void zcosaTest(void) {
- doubleComplex in[4];
- doubleComplex out[4];
- int i = 0;
-
- in[0] = DoubleComplex(PI, PI);
- in[1] = DoubleComplex(PI/2, PI/2);
- in[2] = DoubleComplex(PI/2, PI/3);
- in[3] = DoubleComplex(PI/2, PI/4);
-
- zcosa(in, 4, out);
- printf(">> Double Complex Array\n");
- for (i = 0 ; i < 4 ; ++i)
- printf("zcosa(array) = %e + I * %e\n", zreals(out[i]), zimags(out[i]));
-}
-
-int testCos(void) {
- printf("\n>>>> Cosine Tests\n");
- scossTest();
- dcossTest();
- ccossTest();
- zcossTest();
- scosaTest();
- dcosaTest();
- ccosaTest();
- zcosaTest();
- return 0;
-}
-
-int main(void) {
- assert(testCos() == 0);
- return 0;
-}
diff --git a/src/elementaryFunctions/cos/testCos.h b/src/elementaryFunctions/cos/testCos.h
index 41a9373c..82dac484 100644
--- a/src/elementaryFunctions/cos/testCos.h
+++ b/src/elementaryFunctions/cos/testCos.h
@@ -1,14 +1,14 @@
/*
-** -*- C -*-
-**
-** testCos.h
-** Made by Bruno JOFRET <bruno.jofret@inria.fr>
-**
-** Started on Mon Mar 26 16:33:11 2007 jofret
-** Last update Fri Mar 30 12:04:25 2007 jofret
-**
-** Copyright INRIA 2007
-*/
+ * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+ * Copyright (C) 2008-2008 - INRIA - Bruno JOFRET
+ *
+ * This file must be used under the terms of the CeCILL.
+ * This source file is licensed as described in the file COPYING, which
+ * you should have received as part of this distribution. The terms
+ * are also available at
+ * http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt
+ *
+ */
#ifndef _TESTCOS_H_
#define _TESTCOS_H_
diff --git a/src/elementaryFunctions/cos/testDoubleCos.c b/src/elementaryFunctions/cos/testDoubleCos.c
new file mode 100644
index 00000000..00499278
--- /dev/null
+++ b/src/elementaryFunctions/cos/testDoubleCos.c
@@ -0,0 +1,88 @@
+/*
+ * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+ * Copyright (C) 2006-2008 - INRIA - Bruno JOFRET
+ *
+ * This file must be used under the terms of the CeCILL.
+ * This source file is licensed as described in the file COPYING, which
+ * you should have received as part of this distribution. The terms
+ * are also available at
+ * http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt
+ *
+ */
+
+#include "testCos.h"
+
+void dcossTest(void) {
+ printf(">> Double scalar\n");
+ printf("dcoss(0) = %e\n", dcoss(0.0));
+ printf("dcoss(PI) = %e\n", dcoss(DPI));
+ printf("dcoss(PI/2) = %e\n", dcoss(DPI/2));
+ printf("dcoss(PI/3) = %e\n", dcoss(DPI/3));
+ printf("dcoss(PI/4) = %e\n", dcoss(DPI/4));
+ printf("dcoss(PI/6) = %e\n", dcoss(DPI/6));
+ printf("dcoss(-PI) = %e\n", dcoss(-DPI));
+ printf("dcoss(-PI/2) = %e\n", dcoss(-DPI/2));
+ printf("dcoss(-PI/3) = %e\n", dcoss(-DPI/3));
+ printf("dcoss(-PI/4) = %e\n", dcoss(-DPI/4));
+ printf("dcoss(-PI/6) = %e\n", dcoss(-DPI/6));
+}
+
+void zcossTest(void) {
+ doubleComplex pi_pi = DoubleComplex(DPI, DPI);
+ doubleComplex pi_2_pi_2 = DoubleComplex(DPI/2, DPI/2);
+ doubleComplex pi_2_pi_3 = DoubleComplex(DPI/2, DPI/3);
+ doubleComplex pi_2_pi_4 = DoubleComplex(DPI/2, DPI/4);
+ doubleComplex out;
+
+ printf(">> Double Complex scalar\n");
+ out = zcoss(pi_pi);
+ printf("zcoss(PI + I*PI) = %e + I * %e\n", zreals(out), zimags(out));
+ out = zcoss(pi_2_pi_2);
+ printf("zcoss(PI/2 + I*PI/2) = %e + I * %e\n", zreals(out), zimags(out));
+ out = zcoss(pi_2_pi_3);
+ printf("zcoss(PI/2 + I*PI/3) = %e + I * %e\n", zreals(out), zimags(out));
+ out = zcoss(pi_2_pi_4);
+ printf("zcoss(PI/2 + I*PI/4) = %e + I * %e\n", zreals(out), zimags(out));
+}
+
+void dcosaTest(void) {
+ double out[5];
+ double in[5] = {DPI, DPI/2, DPI/3, DPI/4, DPI/6};
+ int i = 0;
+
+ printf(">> Double Array\n");
+ dcosa(in, 5, out);
+ for (i = 0 ; i < 5 ; ++i)
+ printf("scosa(array) = %f\n", out[i]);
+
+}
+
+void zcosaTest(void) {
+ doubleComplex in[4];
+ doubleComplex out[4];
+ int i = 0;
+
+ in[0] = DoubleComplex(DPI, DPI);
+ in[1] = DoubleComplex(DPI/2, DPI/2);
+ in[2] = DoubleComplex(DPI/2, DPI/3);
+ in[3] = DoubleComplex(DPI/2, DPI/4);
+
+ zcosa(in, 4, out);
+ printf(">> Double Complex Array\n");
+ for (i = 0 ; i < 4 ; ++i)
+ printf("zcosa(array) = %e + I * %e\n", zreals(out[i]), zimags(out[i]));
+}
+
+int testCos(void) {
+ printf("\n>>>> Double Cosine Tests\n");
+ dcossTest();
+ zcossTest();
+ dcosaTest();
+ zcosaTest();
+ return 0;
+}
+
+int main(void) {
+ assert(testCos() == 0);
+ return 0;
+}
diff --git a/src/elementaryFunctions/cos/testFloatCos.c b/src/elementaryFunctions/cos/testFloatCos.c
new file mode 100644
index 00000000..d6d07416
--- /dev/null
+++ b/src/elementaryFunctions/cos/testFloatCos.c
@@ -0,0 +1,87 @@
+/*
+ * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+ * Copyright (C) 2006-2008 - INRIA - Bruno JOFRET
+ *
+ * This file must be used under the terms of the CeCILL.
+ * This source file is licensed as described in the file COPYING, which
+ * you should have received as part of this distribution. The terms
+ * are also available at
+ * http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt
+ *
+ */
+
+#include "testCos.h"
+
+void scossTest(void) {
+ printf(">> Float scalar\n");
+ printf("scoss(0) = %f\n", scoss(0.0f));
+ printf("scoss(PI) = %f\n", scoss(FPI));
+ printf("scoss(PI/2) = %f\n", scoss(FPI/2));
+ printf("scoss(PI/3) = %f\n", scoss(FPI/3));
+ printf("scoss(PI/4) = %f\n", scoss(FPI/4));
+ printf("scoss(PI/6) = %f\n", scoss(FPI/6));
+ printf("scoss(-PI) = %f\n", scoss(-FPI));
+ printf("scoss(-PI/2) = %f\n", scoss(-FPI/2));
+ printf("scoss(-PI/3) = %f\n", scoss(-FPI/3));
+ printf("scoss(-PI/4) = %f\n", scoss(-FPI/4));
+ printf("scoss(-PI/6) = %f\n", scoss(-FPI/6));
+}
+
+void ccossTest(void) {
+ floatComplex pi_pi = FloatComplex(FPI, FPI);
+ floatComplex pi_2_pi_2 = FloatComplex(FPI/2, FPI/2);
+ floatComplex pi_2_pi_3 = FloatComplex(FPI/2, FPI/3);
+ floatComplex pi_2_pi_4 = FloatComplex(FPI/2, FPI/4);
+ floatComplex out;
+
+ printf(">> Float Complex scalar\n");
+ out = ccoss(pi_pi);
+ printf("ccoss(PI + I*PI) = %f + I * %f\n", creals(out), cimags(out));
+ out = ccoss(pi_2_pi_2);
+ printf("ccoss(PI/2 + I*PI/2) = %f + I * %f\n", creals(out), cimags(out));
+ out = ccoss(pi_2_pi_3);
+ printf("ccoss(PI/2 + I*PI/3) = %f + I * %f\n", creals(out), cimags(out));
+ out = ccoss(pi_2_pi_4);
+ printf("ccoss(PI/2 + I*PI/4) = %f + I * %f\n", creals(out), cimags(out));
+}
+
+void scosaTest(void) {
+ float out[5];
+ float in[5] = {FPI, FPI/2, FPI/3, FPI/4, FPI/6};
+ int i = 0;
+
+ printf(">> Float array\n");
+ scosa(in, 5, out);
+ for (i = 0 ; i < 5 ; ++i)
+ printf("scosa(array) = %f\n", out[i]);
+}
+
+void ccosaTest(void) {
+ floatComplex in[4];
+ floatComplex out[4];
+ int i = 0;
+
+ in[0] = FloatComplex(FPI, FPI);
+ in[1] = FloatComplex(FPI/2, FPI/2);
+ in[2] = FloatComplex(FPI/2, FPI/3);
+ in[3] = FloatComplex(FPI/2, FPI/4);
+
+ ccosa(in, 4, out);
+ printf(">> Float Complex Array\n");
+ for (i = 0 ; i < 4 ; ++i)
+ printf("ccosa(array) = %e + I * %e\n", creals(out[i]), cimags(out[i]));
+}
+
+int testCos(void) {
+ printf("\n>>>> Float Cosine Tests\n");
+ scossTest();
+ ccossTest();
+ scosaTest();
+ ccosaTest();
+ return 0;
+}
+
+int main(void) {
+ assert(testCos() == 0);
+ return 0;
+}