diff options
author | jofret | 2008-04-18 09:22:02 +0000 |
---|---|---|
committer | jofret | 2008-04-18 09:22:02 +0000 |
commit | f32589693c578961c3e3b0bcd2053ec1d238b70d (patch) | |
tree | c389b8e88329053c85b6a55869fdd309d9462d34 /src/elementaryFunctions | |
parent | ab5ac1b2a3c2c07921aa994dee775ec8e679c447 (diff) | |
download | scilab2c-f32589693c578961c3e3b0bcd2053ec1d238b70d.tar.gz scilab2c-f32589693c578961c3e3b0bcd2053ec1d238b70d.tar.bz2 scilab2c-f32589693c578961c3e3b0bcd2053ec1d238b70d.zip |
Double vs Float better management. Enable psycho warnings.
Diffstat (limited to 'src/elementaryFunctions')
-rw-r--r-- | src/elementaryFunctions/acos/Makefile.am | 22 | ||||
-rw-r--r-- | src/elementaryFunctions/acos/Makefile.in | 93 | ||||
-rw-r--r-- | src/elementaryFunctions/acos/sacoss.c | 22 | ||||
-rw-r--r-- | src/elementaryFunctions/acos/testAcos.c | 152 | ||||
-rw-r--r-- | src/elementaryFunctions/acos/testDoubleAcos.c | 88 | ||||
-rw-r--r-- | src/elementaryFunctions/acos/testFloatAcos.c | 87 | ||||
-rw-r--r-- | src/elementaryFunctions/acos/zacoss.c | 22 |
7 files changed, 273 insertions, 213 deletions
diff --git a/src/elementaryFunctions/acos/Makefile.am b/src/elementaryFunctions/acos/Makefile.am index b5c6e22b..c6e2a4e4 100644 --- a/src/elementaryFunctions/acos/Makefile.am +++ b/src/elementaryFunctions/acos/Makefile.am @@ -37,16 +37,22 @@ HEAD = ../includes/acos.h check_INCLUDES = -I $(top_builddir)/elementaryFunctions/includes \ -I $(top_builddir)/type -check_PROGRAMS = testAcos +check_LDADD = $(top_builddir)/type/libDoubleComplex.la \ + $(top_builddir)/type/libFloatComplex.la \ + $(top_builddir)/elementaryFunctions/acos/libAcos.la \ + @LIBMATH@ + +check_PROGRAMS = testFloatAcos testDoubleAcos -TESTS = testAcos +TESTS = testFloatAcos testDoubleAcos # # -*- Acosine Tests -*- # -testAcos_SOURCES = testAcos.c -testAcos_CFLAGS = $(check_INCLUDES) -testAcos_LDADD = $(top_builddir)/type/libDoubleComplex.la \ - $(top_builddir)/type/libFloatComplex.la \ - $(top_builddir)/elementaryFunctions/acos/libAcos.la \ - @LIBMATH@
\ No newline at end of file +testFloatAcos_SOURCES = testFloatAcos.c +testFloatAcos_CFLAGS = $(check_INCLUDES) +testFloatAcos_LDADD = $(check_LDADD) + +testDoubleAcos_SOURCES = testDoubleAcos.c +testDoubleAcos_CFLAGS = $(check_INCLUDES) +testDoubleAcos_LDADD = $(check_LDADD) diff --git a/src/elementaryFunctions/acos/Makefile.in b/src/elementaryFunctions/acos/Makefile.in index 71bab8be..77869f41 100644 --- a/src/elementaryFunctions/acos/Makefile.in +++ b/src/elementaryFunctions/acos/Makefile.in @@ -32,8 +32,8 @@ PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ -check_PROGRAMS = testAcos$(EXEEXT) -TESTS = testAcos$(EXEEXT) +check_PROGRAMS = testFloatAcos$(EXEEXT) testDoubleAcos$(EXEEXT) +TESTS = testFloatAcos$(EXEEXT) testDoubleAcos$(EXEEXT) subdir = elementaryFunctions/acos DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 @@ -62,14 +62,21 @@ libAcos_la_OBJECTS = $(am_libAcos_la_OBJECTS) libAcos_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(libAcos_la_CFLAGS) \ $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ -am_testAcos_OBJECTS = testAcos-testAcos.$(OBJEXT) -testAcos_OBJECTS = $(am_testAcos_OBJECTS) -testAcos_DEPENDENCIES = $(top_builddir)/type/libDoubleComplex.la \ +am_testDoubleAcos_OBJECTS = testDoubleAcos-testDoubleAcos.$(OBJEXT) +testDoubleAcos_OBJECTS = $(am_testDoubleAcos_OBJECTS) +am__DEPENDENCIES_1 = $(top_builddir)/type/libDoubleComplex.la \ $(top_builddir)/type/libFloatComplex.la \ $(top_builddir)/elementaryFunctions/acos/libAcos.la -testAcos_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ - --mode=link $(CCLD) $(testAcos_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \ - $(LDFLAGS) -o $@ +testDoubleAcos_DEPENDENCIES = $(am__DEPENDENCIES_1) +testDoubleAcos_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=link $(CCLD) $(testDoubleAcos_CFLAGS) \ + $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ +am_testFloatAcos_OBJECTS = testFloatAcos-testFloatAcos.$(OBJEXT) +testFloatAcos_OBJECTS = $(am_testFloatAcos_OBJECTS) +testFloatAcos_DEPENDENCIES = $(am__DEPENDENCIES_1) +testFloatAcos_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=link $(CCLD) $(testFloatAcos_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 @@ -82,8 +89,10 @@ CCLD = $(CC) LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \ $(LDFLAGS) -o $@ -SOURCES = $(libAcos_la_SOURCES) $(testAcos_SOURCES) -DIST_SOURCES = $(libAcos_la_SOURCES) $(testAcos_SOURCES) +SOURCES = $(libAcos_la_SOURCES) $(testDoubleAcos_SOURCES) \ + $(testFloatAcos_SOURCES) +DIST_SOURCES = $(libAcos_la_SOURCES) $(testDoubleAcos_SOURCES) \ + $(testFloatAcos_SOURCES) ETAGS = etags CTAGS = ctags DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) @@ -218,17 +227,21 @@ HEAD = ../includes/acos.h check_INCLUDES = -I $(top_builddir)/elementaryFunctions/includes \ -I $(top_builddir)/type - -# -# -*- Acosine Tests -*- -# -testAcos_SOURCES = testAcos.c -testAcos_CFLAGS = $(check_INCLUDES) -testAcos_LDADD = $(top_builddir)/type/libDoubleComplex.la \ +check_LDADD = $(top_builddir)/type/libDoubleComplex.la \ $(top_builddir)/type/libFloatComplex.la \ $(top_builddir)/elementaryFunctions/acos/libAcos.la \ @LIBMATH@ + +# +# -*- Acosine Tests -*- +# +testFloatAcos_SOURCES = testFloatAcos.c +testFloatAcos_CFLAGS = $(check_INCLUDES) +testFloatAcos_LDADD = $(check_LDADD) +testDoubleAcos_SOURCES = testDoubleAcos.c +testDoubleAcos_CFLAGS = $(check_INCLUDES) +testDoubleAcos_LDADD = $(check_LDADD) all: all-am .SUFFIXES: @@ -298,9 +311,12 @@ clean-checkPROGRAMS: echo " rm -f $$p $$f"; \ rm -f $$p $$f ; \ done -testAcos$(EXEEXT): $(testAcos_OBJECTS) $(testAcos_DEPENDENCIES) - @rm -f testAcos$(EXEEXT) - $(testAcos_LINK) $(testAcos_OBJECTS) $(testAcos_LDADD) $(LIBS) +testDoubleAcos$(EXEEXT): $(testDoubleAcos_OBJECTS) $(testDoubleAcos_DEPENDENCIES) + @rm -f testDoubleAcos$(EXEEXT) + $(testDoubleAcos_LINK) $(testDoubleAcos_OBJECTS) $(testDoubleAcos_LDADD) $(LIBS) +testFloatAcos$(EXEEXT): $(testFloatAcos_OBJECTS) $(testFloatAcos_DEPENDENCIES) + @rm -f testFloatAcos$(EXEEXT) + $(testFloatAcos_LINK) $(testFloatAcos_OBJECTS) $(testFloatAcos_LDADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) @@ -316,7 +332,8 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libAcos_la-sacoss.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libAcos_la-zacosa.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libAcos_la-zacoss.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/testAcos-testAcos.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/testDoubleAcos-testDoubleAcos.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/testFloatAcos-testFloatAcos.Po@am__quote@ .c.o: @am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @@ -395,19 +412,33 @@ libAcos_la-zacosa.lo: zacosa.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) $(libAcos_la_CFLAGS) $(CFLAGS) -c -o libAcos_la-zacosa.lo `test -f 'zacosa.c' || echo '$(srcdir)/'`zacosa.c -testAcos-testAcos.o: testAcos.c -@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(testAcos_CFLAGS) $(CFLAGS) -MT testAcos-testAcos.o -MD -MP -MF $(DEPDIR)/testAcos-testAcos.Tpo -c -o testAcos-testAcos.o `test -f 'testAcos.c' || echo '$(srcdir)/'`testAcos.c -@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/testAcos-testAcos.Tpo $(DEPDIR)/testAcos-testAcos.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='testAcos.c' object='testAcos-testAcos.o' libtool=no @AMDEPBACKSLASH@ +testDoubleAcos-testDoubleAcos.o: testDoubleAcos.c +@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(testDoubleAcos_CFLAGS) $(CFLAGS) -MT testDoubleAcos-testDoubleAcos.o -MD -MP -MF $(DEPDIR)/testDoubleAcos-testDoubleAcos.Tpo -c -o testDoubleAcos-testDoubleAcos.o `test -f 'testDoubleAcos.c' || echo '$(srcdir)/'`testDoubleAcos.c +@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/testDoubleAcos-testDoubleAcos.Tpo $(DEPDIR)/testDoubleAcos-testDoubleAcos.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='testDoubleAcos.c' object='testDoubleAcos-testDoubleAcos.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) $(testDoubleAcos_CFLAGS) $(CFLAGS) -c -o testDoubleAcos-testDoubleAcos.o `test -f 'testDoubleAcos.c' || echo '$(srcdir)/'`testDoubleAcos.c + +testDoubleAcos-testDoubleAcos.obj: testDoubleAcos.c +@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(testDoubleAcos_CFLAGS) $(CFLAGS) -MT testDoubleAcos-testDoubleAcos.obj -MD -MP -MF $(DEPDIR)/testDoubleAcos-testDoubleAcos.Tpo -c -o testDoubleAcos-testDoubleAcos.obj `if test -f 'testDoubleAcos.c'; then $(CYGPATH_W) 'testDoubleAcos.c'; else $(CYGPATH_W) '$(srcdir)/testDoubleAcos.c'; fi` +@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/testDoubleAcos-testDoubleAcos.Tpo $(DEPDIR)/testDoubleAcos-testDoubleAcos.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='testDoubleAcos.c' object='testDoubleAcos-testDoubleAcos.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) $(testDoubleAcos_CFLAGS) $(CFLAGS) -c -o testDoubleAcos-testDoubleAcos.obj `if test -f 'testDoubleAcos.c'; then $(CYGPATH_W) 'testDoubleAcos.c'; else $(CYGPATH_W) '$(srcdir)/testDoubleAcos.c'; fi` + +testFloatAcos-testFloatAcos.o: testFloatAcos.c +@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(testFloatAcos_CFLAGS) $(CFLAGS) -MT testFloatAcos-testFloatAcos.o -MD -MP -MF $(DEPDIR)/testFloatAcos-testFloatAcos.Tpo -c -o testFloatAcos-testFloatAcos.o `test -f 'testFloatAcos.c' || echo '$(srcdir)/'`testFloatAcos.c +@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/testFloatAcos-testFloatAcos.Tpo $(DEPDIR)/testFloatAcos-testFloatAcos.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='testFloatAcos.c' object='testFloatAcos-testFloatAcos.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) $(testAcos_CFLAGS) $(CFLAGS) -c -o testAcos-testAcos.o `test -f 'testAcos.c' || echo '$(srcdir)/'`testAcos.c +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(testFloatAcos_CFLAGS) $(CFLAGS) -c -o testFloatAcos-testFloatAcos.o `test -f 'testFloatAcos.c' || echo '$(srcdir)/'`testFloatAcos.c -testAcos-testAcos.obj: testAcos.c -@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(testAcos_CFLAGS) $(CFLAGS) -MT testAcos-testAcos.obj -MD -MP -MF $(DEPDIR)/testAcos-testAcos.Tpo -c -o testAcos-testAcos.obj `if test -f 'testAcos.c'; then $(CYGPATH_W) 'testAcos.c'; else $(CYGPATH_W) '$(srcdir)/testAcos.c'; fi` -@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/testAcos-testAcos.Tpo $(DEPDIR)/testAcos-testAcos.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='testAcos.c' object='testAcos-testAcos.obj' libtool=no @AMDEPBACKSLASH@ +testFloatAcos-testFloatAcos.obj: testFloatAcos.c +@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(testFloatAcos_CFLAGS) $(CFLAGS) -MT testFloatAcos-testFloatAcos.obj -MD -MP -MF $(DEPDIR)/testFloatAcos-testFloatAcos.Tpo -c -o testFloatAcos-testFloatAcos.obj `if test -f 'testFloatAcos.c'; then $(CYGPATH_W) 'testFloatAcos.c'; else $(CYGPATH_W) '$(srcdir)/testFloatAcos.c'; fi` +@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/testFloatAcos-testFloatAcos.Tpo $(DEPDIR)/testFloatAcos-testFloatAcos.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='testFloatAcos.c' object='testFloatAcos-testFloatAcos.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) $(testAcos_CFLAGS) $(CFLAGS) -c -o testAcos-testAcos.obj `if test -f 'testAcos.c'; then $(CYGPATH_W) 'testAcos.c'; else $(CYGPATH_W) '$(srcdir)/testAcos.c'; fi` +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(testFloatAcos_CFLAGS) $(CFLAGS) -c -o testFloatAcos-testFloatAcos.obj `if test -f 'testFloatAcos.c'; then $(CYGPATH_W) 'testFloatAcos.c'; else $(CYGPATH_W) '$(srcdir)/testFloatAcos.c'; fi` mostlyclean-libtool: -rm -f *.lo diff --git a/src/elementaryFunctions/acos/sacoss.c b/src/elementaryFunctions/acos/sacoss.c index 8bb72881..733c8afe 100644 --- a/src/elementaryFunctions/acos/sacoss.c +++ b/src/elementaryFunctions/acos/sacoss.c @@ -1,18 +1,18 @@ /* -** -*- C -*- -** -** sacoss.c -** Made by Bruno JOFRET <bruno.jofret@inria.fr> -** -** Started on Fri Jan 5 10:25:44 2007 jofret -** Last update Fri Apr 20 14:44:01 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 + * + */ #include <math.h> #include "acos.h" float sacoss(float x) { - return (acos(x)); + return (acosf(x)); } diff --git a/src/elementaryFunctions/acos/testAcos.c b/src/elementaryFunctions/acos/testAcos.c deleted file mode 100644 index 2ddd799d..00000000 --- a/src/elementaryFunctions/acos/testAcos.c +++ /dev/null @@ -1,152 +0,0 @@ -/* -** -*- C -*- -** -** testAcos.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:55:22 2007 bruno -** -** Copyright INRIA 2006 -*/ - -#include "testAcos.h" - -void sacossTest(void) { - printf(">> Float scalar\n"); - printf("sacoss(0) = %f\n", sacoss((float) 0)); - printf("sacoss(PI) = %f\n", sacoss(PI)); - printf("sacoss(PI/2) = %f\n", sacoss(PI/2)); - printf("sacoss(PI/3) = %f\n", sacoss(PI/3)); - printf("sacoss(PI/4) = %f\n", sacoss(PI/4)); - printf("sacoss(PI/6) = %f\n", sacoss(PI/6)); - printf("sacoss(-PI) = %f\n", sacoss(-PI)); - printf("sacoss(-PI/2) = %f\n", sacoss(-PI/2)); - printf("sacoss(-PI/3) = %f\n", sacoss(-PI/3)); - printf("sacoss(-PI/4) = %f\n", sacoss(-PI/4)); - printf("sacoss(-PI/6) = %f\n", sacoss(-PI/6)); -} - -void dacossTest(void) { - printf(">> Double scalar\n"); - printf("dacoss(0) = %e\n", dacoss((double) 0)); - printf("dacoss(PI) = %e\n", dacoss(PI)); - printf("dacoss(PI/2) = %e\n", dacoss(PI/2)); - printf("dacoss(PI/3) = %e\n", dacoss(PI/3)); - printf("dacoss(PI/4) = %e\n", dacoss(PI/4)); - printf("dacoss(PI/6) = %e\n", dacoss(PI/6)); - printf("dacoss(-PI) = %e\n", dacoss(-PI)); - printf("dacoss(-PI/2) = %e\n", dacoss(-PI/2)); - printf("dacoss(-PI/3) = %e\n", dacoss(-PI/3)); - printf("dacoss(-PI/4) = %e\n", dacoss(-PI/4)); - printf("dacoss(-PI/6) = %e\n", dacoss(-PI/6)); -} - -void cacossTest(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 = cacoss(pi_pi); - printf("cacoss(PI + I*PI) = %f + I * %f\n", creals(out), cimags(out)); - out = cacoss(pi_2_pi_2); - printf("cacoss(PI/2 + I*PI/2) = %f + I * %f\n", creals(out), cimags(out)); - out = cacoss(pi_2_pi_3); - printf("cacoss(PI/2 + I*PI/3) = %f + I * %f\n", creals(out), cimags(out)); - out = cacoss(pi_2_pi_4); - printf("cacoss(PI/2 + I*PI/4) = %f + I * %f\n", creals(out), cimags(out)); -} - -void zacossTest(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 = zacoss(pi_pi); - printf("zacoss(PI + I*PI) = %e + I * %e\n", zreals(out), zimags(out)); - out = zacoss(pi_2_pi_2); - printf("zacoss(PI/2 + I*PI/2) = %e + I * %e\n", zreals(out), zimags(out)); - out = zacoss(pi_2_pi_3); - printf("zacoss(PI/2 + I*PI/3) = %e + I * %e\n", zreals(out), zimags(out)); - out = zacoss(pi_2_pi_4); - printf("zacoss(PI/2 + I*PI/4) = %e + I * %e\n", zreals(out), zimags(out)); -} - -void sacosaTest(void) { - float out[5]; - float in[5] = {PI, PI/2, PI/3, PI/4, PI/6}; - int i = 0; - - printf(">> Float array\n"); - sacosa(in, 5, out); - for (i = 0 ; i < 5 ; ++i) - printf("sacosa(array) = %f\n", out[i]); -} - -void dacosaTest(void) { - double out[5]; - double in[5] = {PI, PI/2, PI/3, PI/4, PI/6}; - int i = 0; - - printf(">> Double Array\n"); - dacosa(in, 5, out); - for (i = 0 ; i < 5 ; ++i) - printf("sacosa(array) = %f\n", out[i]); - -} - -void cacosaTest(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); - - cacosa(in, 4, out); - printf(">> Float Complex Array\n"); - for (i = 0 ; i < 4 ; ++i) - printf("cacosa(array) = %e + I * %e\n", creals(out[i]), cimags(out[i])); -} - -void zacosaTest(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); - - zacosa(in, 4, out); - printf(">> Double Complex Array\n"); - for (i = 0 ; i < 4 ; ++i) - printf("zacosa(array) = %e + I * %e\n", zreals(out[i]), zimags(out[i])); -} - -int testAcos(void) { - printf("\n>>>> ArcCosine Tests\n"); - sacossTest(); - dacossTest(); - cacossTest(); - zacossTest(); - sacosaTest(); - dacosaTest(); - cacosaTest(); - zacosaTest(); - return 0; -} - -int main(void) { - assert(testAcos() == 0); - return 0; -} diff --git a/src/elementaryFunctions/acos/testDoubleAcos.c b/src/elementaryFunctions/acos/testDoubleAcos.c new file mode 100644 index 00000000..d7cdeb77 --- /dev/null +++ b/src/elementaryFunctions/acos/testDoubleAcos.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 "testAcos.h" + +void dacossTest(void) { + printf(">> Double scalar\n"); + printf("dacoss(0) = %e\n", dacoss((double) 0)); + printf("dacoss(PI) = %e\n", dacoss(DPI)); + printf("dacoss(PI/2) = %e\n", dacoss(DPI/2)); + printf("dacoss(PI/3) = %e\n", dacoss(DPI/3)); + printf("dacoss(PI/4) = %e\n", dacoss(DPI/4)); + printf("dacoss(PI/6) = %e\n", dacoss(DPI/6)); + printf("dacoss(-PI) = %e\n", dacoss(-DPI)); + printf("dacoss(-PI/2) = %e\n", dacoss(-DPI/2)); + printf("dacoss(-PI/3) = %e\n", dacoss(-DPI/3)); + printf("dacoss(-PI/4) = %e\n", dacoss(-DPI/4)); + printf("dacoss(-PI/6) = %e\n", dacoss(-DPI/6)); +} + +void zacossTest(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 = zacoss(pi_pi); + printf("zacoss(PI + I*PI) = %e + I * %e\n", zreals(out), zimags(out)); + out = zacoss(pi_2_pi_2); + printf("zacoss(PI/2 + I*PI/2) = %e + I * %e\n", zreals(out), zimags(out)); + out = zacoss(pi_2_pi_3); + printf("zacoss(PI/2 + I*PI/3) = %e + I * %e\n", zreals(out), zimags(out)); + out = zacoss(pi_2_pi_4); + printf("zacoss(PI/2 + I*PI/4) = %e + I * %e\n", zreals(out), zimags(out)); +} + +void dacosaTest(void) { + double out[5]; + double in[5] = {DPI, DPI/2, DPI/3, DPI/4, DPI/6}; + int i = 0; + + printf(">> Double Array\n"); + dacosa(in, 5, out); + for (i = 0 ; i < 5 ; ++i) + printf("sacosa(array) = %f\n", out[i]); + +} + +void zacosaTest(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); + + zacosa(in, 4, out); + printf(">> Double Complex Array\n"); + for (i = 0 ; i < 4 ; ++i) + printf("zacosa(array) = %e + I * %e\n", zreals(out[i]), zimags(out[i])); +} + +int testAcos(void) { + printf("\n>>>> Double ArcCosine Tests\n"); + dacossTest(); + zacossTest(); + dacosaTest(); + zacosaTest(); + return 0; +} + +int main(void) { + assert(testAcos() == 0); + return 0; +} diff --git a/src/elementaryFunctions/acos/testFloatAcos.c b/src/elementaryFunctions/acos/testFloatAcos.c new file mode 100644 index 00000000..b96ec925 --- /dev/null +++ b/src/elementaryFunctions/acos/testFloatAcos.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 "testAcos.h" + +void sacossTest(void) { + printf(">> Float scalar\n"); + printf("sacoss(0) = %f\n", sacoss((float) 0)); + printf("sacoss(PI) = %f\n", sacoss(FPI)); + printf("sacoss(PI/2) = %f\n", sacoss(FPI/2)); + printf("sacoss(PI/3) = %f\n", sacoss(FPI/3)); + printf("sacoss(PI/4) = %f\n", sacoss(FPI/4)); + printf("sacoss(PI/6) = %f\n", sacoss(FPI/6)); + printf("sacoss(-PI) = %f\n", sacoss(-FPI)); + printf("sacoss(-PI/2) = %f\n", sacoss(-FPI/2)); + printf("sacoss(-PI/3) = %f\n", sacoss(-FPI/3)); + printf("sacoss(-PI/4) = %f\n", sacoss(-FPI/4)); + printf("sacoss(-PI/6) = %f\n", sacoss(-FPI/6)); +} + +void cacossTest(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 = cacoss(pi_pi); + printf("cacoss(PI + I*PI) = %f + I * %f\n", creals(out), cimags(out)); + out = cacoss(pi_2_pi_2); + printf("cacoss(PI/2 + I*PI/2) = %f + I * %f\n", creals(out), cimags(out)); + out = cacoss(pi_2_pi_3); + printf("cacoss(PI/2 + I*PI/3) = %f + I * %f\n", creals(out), cimags(out)); + out = cacoss(pi_2_pi_4); + printf("cacoss(PI/2 + I*PI/4) = %f + I * %f\n", creals(out), cimags(out)); +} + +void sacosaTest(void) { + float out[5]; + float in[5] = {FPI, FPI/2, FPI/3, FPI/4, FPI/6}; + int i = 0; + + printf(">> Float array\n"); + sacosa(in, 5, out); + for (i = 0 ; i < 5 ; ++i) + printf("sacosa(array) = %f\n", out[i]); +} + +void cacosaTest(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); + + cacosa(in, 4, out); + printf(">> Float Complex Array\n"); + for (i = 0 ; i < 4 ; ++i) + printf("cacosa(array) = %e + I * %e\n", creals(out[i]), cimags(out[i])); +} + +int testAcos(void) { + printf("\n>>>> Float ArcCosine Tests\n"); + sacossTest(); + cacossTest(); + sacosaTest(); + cacosaTest(); + return 0; +} + +int main(void) { + assert(testAcos() == 0); + return 0; +} diff --git a/src/elementaryFunctions/acos/zacoss.c b/src/elementaryFunctions/acos/zacoss.c index 908b55e2..5dfd4b70 100644 --- a/src/elementaryFunctions/acos/zacoss.c +++ b/src/elementaryFunctions/acos/zacoss.c @@ -1,18 +1,18 @@ /* -** -*- C -*- -** -** zacoss.c -** Made by Bruno JOFRET <bruno.jofret@inria.fr> -** -** Started on Fri Jan 5 10:24:38 2007 jofret -** Last update Fri Feb 23 16:36:16 2007 jofret -** -** Copyright INRIA 2007 -*/ + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2007-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 "acos.h" doubleComplex zacoss(doubleComplex z) { /* FIXME: Dummy... */ - return (DoubleComplex(0,1)); + return z; } |