diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/elementaryFunctions/cosh/Makefile.am | 26 | ||||
-rw-r--r-- | src/elementaryFunctions/cosh/Makefile.in | 93 | ||||
-rw-r--r-- | src/elementaryFunctions/cosh/scoshs.c | 22 | ||||
-rw-r--r-- | src/elementaryFunctions/cosh/testCosh.c | 152 | ||||
-rw-r--r-- | src/elementaryFunctions/cosh/testDoubleCosh.c | 88 | ||||
-rw-r--r-- | src/elementaryFunctions/cosh/testFloatCosh.c | 87 |
6 files changed, 264 insertions, 204 deletions
diff --git a/src/elementaryFunctions/cosh/Makefile.am b/src/elementaryFunctions/cosh/Makefile.am index 566d46b9..d3a80988 100644 --- a/src/elementaryFunctions/cosh/Makefile.am +++ b/src/elementaryFunctions/cosh/Makefile.am @@ -37,19 +37,25 @@ HEAD = ../includes/cosh.h check_INCLUDES = -I $(top_builddir)/elementaryFunctions/includes \ -I $(top_builddir)/type -check_PROGRAMS = testCosh - -TESTS = testCosh - -# -# -*- Hyperbolic Cosine Tests -*- -# -testCosh_SOURCES = testCosh.c -testCosh_CFLAGS = $(check_INCLUDES) -testCosh_LDADD = $(top_builddir)/type/libDoubleComplex.la \ +check_LDADD = $(top_builddir)/type/libDoubleComplex.la \ $(top_builddir)/type/libFloatComplex.la \ $(top_builddir)/elementaryFunctions/cosh/libCosh.la \ $(top_builddir)/elementaryFunctions/cos/libCos.la \ $(top_builddir)/elementaryFunctions/sinh/libSinh.la \ $(top_builddir)/elementaryFunctions/sin/libSin.la \ @LIBMATH@ + +check_PROGRAMS = testFloatCosh testDoubleCosh + +TESTS = testFloatCosh testDoubleCosh + +# +# -*- Hyperbolic Cosine Tests -*- +# +testFloatCosh_SOURCES = testFloatCosh.c +testFloatCosh_CFLAGS = $(check_INCLUDES) +testFloatCosh_LDADD = $(check_LDADD) + +testDoubleCosh_SOURCES = testDoubleCosh.c +testDoubleCosh_CFLAGS = $(check_INCLUDES) +testDoubleCosh_LDADD = $(check_LDADD) diff --git a/src/elementaryFunctions/cosh/Makefile.in b/src/elementaryFunctions/cosh/Makefile.in index 977c19fb..051dafd7 100644 --- a/src/elementaryFunctions/cosh/Makefile.in +++ b/src/elementaryFunctions/cosh/Makefile.in @@ -32,8 +32,8 @@ PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ -check_PROGRAMS = testCosh$(EXEEXT) -TESTS = testCosh$(EXEEXT) +check_PROGRAMS = testFloatCosh$(EXEEXT) testDoubleCosh$(EXEEXT) +TESTS = testFloatCosh$(EXEEXT) testDoubleCosh$(EXEEXT) subdir = elementaryFunctions/cosh DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 @@ -62,17 +62,24 @@ libCosh_la_OBJECTS = $(am_libCosh_la_OBJECTS) libCosh_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(libCosh_la_CFLAGS) \ $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ -am_testCosh_OBJECTS = testCosh-testCosh.$(OBJEXT) -testCosh_OBJECTS = $(am_testCosh_OBJECTS) -testCosh_DEPENDENCIES = $(top_builddir)/type/libDoubleComplex.la \ +am_testDoubleCosh_OBJECTS = testDoubleCosh-testDoubleCosh.$(OBJEXT) +testDoubleCosh_OBJECTS = $(am_testDoubleCosh_OBJECTS) +am__DEPENDENCIES_1 = $(top_builddir)/type/libDoubleComplex.la \ $(top_builddir)/type/libFloatComplex.la \ $(top_builddir)/elementaryFunctions/cosh/libCosh.la \ $(top_builddir)/elementaryFunctions/cos/libCos.la \ $(top_builddir)/elementaryFunctions/sinh/libSinh.la \ $(top_builddir)/elementaryFunctions/sin/libSin.la -testCosh_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ - --mode=link $(CCLD) $(testCosh_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \ - $(LDFLAGS) -o $@ +testDoubleCosh_DEPENDENCIES = $(am__DEPENDENCIES_1) +testDoubleCosh_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=link $(CCLD) $(testDoubleCosh_CFLAGS) \ + $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ +am_testFloatCosh_OBJECTS = testFloatCosh-testFloatCosh.$(OBJEXT) +testFloatCosh_OBJECTS = $(am_testFloatCosh_OBJECTS) +testFloatCosh_DEPENDENCIES = $(am__DEPENDENCIES_1) +testFloatCosh_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=link $(CCLD) $(testFloatCosh_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 = $(libCosh_la_SOURCES) $(testCosh_SOURCES) -DIST_SOURCES = $(libCosh_la_SOURCES) $(testCosh_SOURCES) +SOURCES = $(libCosh_la_SOURCES) $(testDoubleCosh_SOURCES) \ + $(testFloatCosh_SOURCES) +DIST_SOURCES = $(libCosh_la_SOURCES) $(testDoubleCosh_SOURCES) \ + $(testFloatCosh_SOURCES) ETAGS = etags CTAGS = ctags DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) @@ -221,13 +230,7 @@ HEAD = ../includes/cosh.h check_INCLUDES = -I $(top_builddir)/elementaryFunctions/includes \ -I $(top_builddir)/type - -# -# -*- Hyperbolic Cosine Tests -*- -# -testCosh_SOURCES = testCosh.c -testCosh_CFLAGS = $(check_INCLUDES) -testCosh_LDADD = $(top_builddir)/type/libDoubleComplex.la \ +check_LDADD = $(top_builddir)/type/libDoubleComplex.la \ $(top_builddir)/type/libFloatComplex.la \ $(top_builddir)/elementaryFunctions/cosh/libCosh.la \ $(top_builddir)/elementaryFunctions/cos/libCos.la \ @@ -235,6 +238,16 @@ testCosh_LDADD = $(top_builddir)/type/libDoubleComplex.la \ $(top_builddir)/elementaryFunctions/sin/libSin.la \ @LIBMATH@ + +# +# -*- Hyperbolic Cosine Tests -*- +# +testFloatCosh_SOURCES = testFloatCosh.c +testFloatCosh_CFLAGS = $(check_INCLUDES) +testFloatCosh_LDADD = $(check_LDADD) +testDoubleCosh_SOURCES = testDoubleCosh.c +testDoubleCosh_CFLAGS = $(check_INCLUDES) +testDoubleCosh_LDADD = $(check_LDADD) all: all-am .SUFFIXES: @@ -304,9 +317,12 @@ clean-checkPROGRAMS: echo " rm -f $$p $$f"; \ rm -f $$p $$f ; \ done -testCosh$(EXEEXT): $(testCosh_OBJECTS) $(testCosh_DEPENDENCIES) - @rm -f testCosh$(EXEEXT) - $(testCosh_LINK) $(testCosh_OBJECTS) $(testCosh_LDADD) $(LIBS) +testDoubleCosh$(EXEEXT): $(testDoubleCosh_OBJECTS) $(testDoubleCosh_DEPENDENCIES) + @rm -f testDoubleCosh$(EXEEXT) + $(testDoubleCosh_LINK) $(testDoubleCosh_OBJECTS) $(testDoubleCosh_LDADD) $(LIBS) +testFloatCosh$(EXEEXT): $(testFloatCosh_OBJECTS) $(testFloatCosh_DEPENDENCIES) + @rm -f testFloatCosh$(EXEEXT) + $(testFloatCosh_LINK) $(testFloatCosh_OBJECTS) $(testFloatCosh_LDADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) @@ -322,7 +338,8 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libCosh_la-scoshs.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libCosh_la-zcosha.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libCosh_la-zcoshs.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/testCosh-testCosh.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/testDoubleCosh-testDoubleCosh.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/testFloatCosh-testFloatCosh.Po@am__quote@ .c.o: @am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @@ -401,19 +418,33 @@ libCosh_la-zcosha.lo: zcosha.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) $(libCosh_la_CFLAGS) $(CFLAGS) -c -o libCosh_la-zcosha.lo `test -f 'zcosha.c' || echo '$(srcdir)/'`zcosha.c -testCosh-testCosh.o: testCosh.c -@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(testCosh_CFLAGS) $(CFLAGS) -MT testCosh-testCosh.o -MD -MP -MF $(DEPDIR)/testCosh-testCosh.Tpo -c -o testCosh-testCosh.o `test -f 'testCosh.c' || echo '$(srcdir)/'`testCosh.c -@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/testCosh-testCosh.Tpo $(DEPDIR)/testCosh-testCosh.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='testCosh.c' object='testCosh-testCosh.o' libtool=no @AMDEPBACKSLASH@ +testDoubleCosh-testDoubleCosh.o: testDoubleCosh.c +@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(testDoubleCosh_CFLAGS) $(CFLAGS) -MT testDoubleCosh-testDoubleCosh.o -MD -MP -MF $(DEPDIR)/testDoubleCosh-testDoubleCosh.Tpo -c -o testDoubleCosh-testDoubleCosh.o `test -f 'testDoubleCosh.c' || echo '$(srcdir)/'`testDoubleCosh.c +@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/testDoubleCosh-testDoubleCosh.Tpo $(DEPDIR)/testDoubleCosh-testDoubleCosh.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='testDoubleCosh.c' object='testDoubleCosh-testDoubleCosh.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) $(testDoubleCosh_CFLAGS) $(CFLAGS) -c -o testDoubleCosh-testDoubleCosh.o `test -f 'testDoubleCosh.c' || echo '$(srcdir)/'`testDoubleCosh.c + +testDoubleCosh-testDoubleCosh.obj: testDoubleCosh.c +@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(testDoubleCosh_CFLAGS) $(CFLAGS) -MT testDoubleCosh-testDoubleCosh.obj -MD -MP -MF $(DEPDIR)/testDoubleCosh-testDoubleCosh.Tpo -c -o testDoubleCosh-testDoubleCosh.obj `if test -f 'testDoubleCosh.c'; then $(CYGPATH_W) 'testDoubleCosh.c'; else $(CYGPATH_W) '$(srcdir)/testDoubleCosh.c'; fi` +@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/testDoubleCosh-testDoubleCosh.Tpo $(DEPDIR)/testDoubleCosh-testDoubleCosh.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='testDoubleCosh.c' object='testDoubleCosh-testDoubleCosh.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) $(testDoubleCosh_CFLAGS) $(CFLAGS) -c -o testDoubleCosh-testDoubleCosh.obj `if test -f 'testDoubleCosh.c'; then $(CYGPATH_W) 'testDoubleCosh.c'; else $(CYGPATH_W) '$(srcdir)/testDoubleCosh.c'; fi` + +testFloatCosh-testFloatCosh.o: testFloatCosh.c +@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(testFloatCosh_CFLAGS) $(CFLAGS) -MT testFloatCosh-testFloatCosh.o -MD -MP -MF $(DEPDIR)/testFloatCosh-testFloatCosh.Tpo -c -o testFloatCosh-testFloatCosh.o `test -f 'testFloatCosh.c' || echo '$(srcdir)/'`testFloatCosh.c +@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/testFloatCosh-testFloatCosh.Tpo $(DEPDIR)/testFloatCosh-testFloatCosh.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='testFloatCosh.c' object='testFloatCosh-testFloatCosh.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) $(testCosh_CFLAGS) $(CFLAGS) -c -o testCosh-testCosh.o `test -f 'testCosh.c' || echo '$(srcdir)/'`testCosh.c +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(testFloatCosh_CFLAGS) $(CFLAGS) -c -o testFloatCosh-testFloatCosh.o `test -f 'testFloatCosh.c' || echo '$(srcdir)/'`testFloatCosh.c -testCosh-testCosh.obj: testCosh.c -@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(testCosh_CFLAGS) $(CFLAGS) -MT testCosh-testCosh.obj -MD -MP -MF $(DEPDIR)/testCosh-testCosh.Tpo -c -o testCosh-testCosh.obj `if test -f 'testCosh.c'; then $(CYGPATH_W) 'testCosh.c'; else $(CYGPATH_W) '$(srcdir)/testCosh.c'; fi` -@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/testCosh-testCosh.Tpo $(DEPDIR)/testCosh-testCosh.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='testCosh.c' object='testCosh-testCosh.obj' libtool=no @AMDEPBACKSLASH@ +testFloatCosh-testFloatCosh.obj: testFloatCosh.c +@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(testFloatCosh_CFLAGS) $(CFLAGS) -MT testFloatCosh-testFloatCosh.obj -MD -MP -MF $(DEPDIR)/testFloatCosh-testFloatCosh.Tpo -c -o testFloatCosh-testFloatCosh.obj `if test -f 'testFloatCosh.c'; then $(CYGPATH_W) 'testFloatCosh.c'; else $(CYGPATH_W) '$(srcdir)/testFloatCosh.c'; fi` +@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/testFloatCosh-testFloatCosh.Tpo $(DEPDIR)/testFloatCosh-testFloatCosh.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='testFloatCosh.c' object='testFloatCosh-testFloatCosh.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) $(testCosh_CFLAGS) $(CFLAGS) -c -o testCosh-testCosh.obj `if test -f 'testCosh.c'; then $(CYGPATH_W) 'testCosh.c'; else $(CYGPATH_W) '$(srcdir)/testCosh.c'; fi` +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(testFloatCosh_CFLAGS) $(CFLAGS) -c -o testFloatCosh-testFloatCosh.obj `if test -f 'testFloatCosh.c'; then $(CYGPATH_W) 'testFloatCosh.c'; else $(CYGPATH_W) '$(srcdir)/testFloatCosh.c'; fi` mostlyclean-libtool: -rm -f *.lo diff --git a/src/elementaryFunctions/cosh/scoshs.c b/src/elementaryFunctions/cosh/scoshs.c index 3f0791de..a42fd27c 100644 --- a/src/elementaryFunctions/cosh/scoshs.c +++ b/src/elementaryFunctions/cosh/scoshs.c @@ -1,18 +1,18 @@ /* -** -*- C -*- -** -** scoshs.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:40:44 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 "cosh.h" float scoshs(float x) { - return (cosh(x)); + return (coshf(x)); } diff --git a/src/elementaryFunctions/cosh/testCosh.c b/src/elementaryFunctions/cosh/testCosh.c deleted file mode 100644 index 35933d3b..00000000 --- a/src/elementaryFunctions/cosh/testCosh.c +++ /dev/null @@ -1,152 +0,0 @@ -/* -** -*- C -*- -** -** testCosh.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:52:54 2007 bruno -** -** Copyright INRIA 2006 -*/ - -#include "testCosh.h" - -void scoshsTest(void) { - printf(">> Float scalar\n"); - printf("scoshs(0) = %f\n", scoshs((float) 0)); - printf("scoshs(PI) = %f\n", scoshs(PI)); - printf("scoshs(PI/2) = %f\n", scoshs(PI/2)); - printf("scoshs(PI/3) = %f\n", scoshs(PI/3)); - printf("scoshs(PI/4) = %f\n", scoshs(PI/4)); - printf("scoshs(PI/6) = %f\n", scoshs(PI/6)); - printf("scoshs(-PI) = %f\n", scoshs(-PI)); - printf("scoshs(-PI/2) = %f\n", scoshs(-PI/2)); - printf("scoshs(-PI/3) = %f\n", scoshs(-PI/3)); - printf("scoshs(-PI/4) = %f\n", scoshs(-PI/4)); - printf("scoshs(-PI/6) = %f\n", scoshs(-PI/6)); -} - -void dcoshsTest(void) { - printf(">> Double scalar\n"); - printf("dcoshs(0) = %e\n", dcoshs((double) 0)); - printf("dcoshs(PI) = %e\n", dcoshs(PI)); - printf("dcoshs(PI/2) = %e\n", dcoshs(PI/2)); - printf("dcoshs(PI/3) = %e\n", dcoshs(PI/3)); - printf("dcoshs(PI/4) = %e\n", dcoshs(PI/4)); - printf("dcoshs(PI/6) = %e\n", dcoshs(PI/6)); - printf("dcoshs(-PI) = %e\n", dcoshs(-PI)); - printf("dcoshs(-PI/2) = %e\n", dcoshs(-PI/2)); - printf("dcoshs(-PI/3) = %e\n", dcoshs(-PI/3)); - printf("dcoshs(-PI/4) = %e\n", dcoshs(-PI/4)); - printf("dcoshs(-PI/6) = %e\n", dcoshs(-PI/6)); -} - -void ccoshsTest(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 = ccoshs(pi_pi); - printf("ccoshs(PI + I*PI) = %f + I * %f\n", creals(out), cimags(out)); - out = ccoshs(pi_2_pi_2); - printf("ccoshs(PI/2 + I*PI/2) = %f + I * %f\n", creals(out), cimags(out)); - out = ccoshs(pi_2_pi_3); - printf("ccoshs(PI/2 + I*PI/3) = %f + I * %f\n", creals(out), cimags(out)); - out = ccoshs(pi_2_pi_4); - printf("ccoshs(PI/2 + I*PI/4) = %f + I * %f\n", creals(out), cimags(out)); -} - -void zcoshsTest(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 = zcoshs(pi_pi); - printf("zcoshs(PI + I*PI) = %e + I * %e\n", zreals(out), zimags(out)); - out = zcoshs(pi_2_pi_2); - printf("zcoshs(PI/2 + I*PI/2) = %e + I * %e\n", zreals(out), zimags(out)); - out = zcoshs(pi_2_pi_3); - printf("zcoshs(PI/2 + I*PI/3) = %e + I * %e\n", zreals(out), zimags(out)); - out = zcoshs(pi_2_pi_4); - printf("zcoshs(PI/2 + I*PI/4) = %e + I * %e\n", zreals(out), zimags(out)); -} - -void scoshaTest(void) { - float out[5]; - float in[5] = {PI, PI/2, PI/3, PI/4, PI/6}; - int i = 0; - - printf(">> Float array\n"); - scosha(in, 5, out); - for (i = 0 ; i < 5 ; ++i) - printf("scosha(array) = %f\n", out[i]); -} - -void dcoshaTest(void) { - double out[5]; - double in[5] = {PI, PI/2, PI/3, PI/4, PI/6}; - int i = 0; - - printf(">> Double Array\n"); - dcosha(in, 5, out); - for (i = 0 ; i < 5 ; ++i) - printf("scosha(array) = %f\n", out[i]); - -} - -void ccoshaTest(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); - - ccosha(in, 4, out); - printf(">> Float Complex Array\n"); - for (i = 0 ; i < 4 ; ++i) - printf("ccosha(array) = %e + I * %e\n", creals(out[i]), cimags(out[i])); -} - -void zcoshaTest(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); - - zcosha(in, 4, out); - printf(">> Double Complex Array\n"); - for (i = 0 ; i < 4 ; ++i) - printf("zcosha(array) = %e + I * %e\n", zreals(out[i]), zimags(out[i])); -} - -int testCosh(void) { - printf("\n>>>> Hyperbolic Cosine Tests\n"); - scoshsTest(); - dcoshsTest(); - ccoshsTest(); - zcoshsTest(); - scoshaTest(); - dcoshaTest(); - ccoshaTest(); - zcoshaTest(); - return 0; -} - -int main(void) { - assert(testCosh() == 0); - return 0; -} diff --git a/src/elementaryFunctions/cosh/testDoubleCosh.c b/src/elementaryFunctions/cosh/testDoubleCosh.c new file mode 100644 index 00000000..12ca432e --- /dev/null +++ b/src/elementaryFunctions/cosh/testDoubleCosh.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 "testCosh.h" + +void dcoshsTest(void) { + printf(">> Double scalar\n"); + printf("dcoshs(0) = %e\n", dcoshs(0.0)); + printf("dcoshs(PI) = %e\n", dcoshs(DPI)); + printf("dcoshs(PI/2) = %e\n", dcoshs(DPI/2)); + printf("dcoshs(PI/3) = %e\n", dcoshs(DPI/3)); + printf("dcoshs(PI/4) = %e\n", dcoshs(DPI/4)); + printf("dcoshs(PI/6) = %e\n", dcoshs(DPI/6)); + printf("dcoshs(-PI) = %e\n", dcoshs(-DPI)); + printf("dcoshs(-PI/2) = %e\n", dcoshs(-DPI/2)); + printf("dcoshs(-PI/3) = %e\n", dcoshs(-DPI/3)); + printf("dcoshs(-PI/4) = %e\n", dcoshs(-DPI/4)); + printf("dcoshs(-PI/6) = %e\n", dcoshs(-DPI/6)); +} + +void zcoshsTest(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 = zcoshs(pi_pi); + printf("zcoshs(PI + I*PI) = %e + I * %e\n", zreals(out), zimags(out)); + out = zcoshs(pi_2_pi_2); + printf("zcoshs(PI/2 + I*PI/2) = %e + I * %e\n", zreals(out), zimags(out)); + out = zcoshs(pi_2_pi_3); + printf("zcoshs(PI/2 + I*PI/3) = %e + I * %e\n", zreals(out), zimags(out)); + out = zcoshs(pi_2_pi_4); + printf("zcoshs(PI/2 + I*PI/4) = %e + I * %e\n", zreals(out), zimags(out)); +} + +void dcoshaTest(void) { + double out[5]; + double in[5] = {DPI, DPI/2, DPI/3, DPI/4, DPI/6}; + int i = 0; + + printf(">> Double Array\n"); + dcosha(in, 5, out); + for (i = 0 ; i < 5 ; ++i) + printf("scosha(array) = %f\n", out[i]); + +} + +void zcoshaTest(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); + + zcosha(in, 4, out); + printf(">> Double Complex Array\n"); + for (i = 0 ; i < 4 ; ++i) + printf("zcosha(array) = %e + I * %e\n", zreals(out[i]), zimags(out[i])); +} + +int testCosh(void) { + printf("\n>>>> Double Hyperbolic Cosine Tests\n"); + dcoshsTest(); + zcoshsTest(); + dcoshaTest(); + zcoshaTest(); + return 0; +} + +int main(void) { + assert(testCosh() == 0); + return 0; +} diff --git a/src/elementaryFunctions/cosh/testFloatCosh.c b/src/elementaryFunctions/cosh/testFloatCosh.c new file mode 100644 index 00000000..b5a8ec20 --- /dev/null +++ b/src/elementaryFunctions/cosh/testFloatCosh.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 "testCosh.h" + +void scoshsTest(void) { + printf(">> Float scalar\n"); + printf("scoshs(0) = %f\n", scoshs(0.0f)); + printf("scoshs(PI) = %f\n", scoshs(FPI)); + printf("scoshs(PI/2) = %f\n", scoshs(FPI/2)); + printf("scoshs(PI/3) = %f\n", scoshs(FPI/3)); + printf("scoshs(PI/4) = %f\n", scoshs(FPI/4)); + printf("scoshs(PI/6) = %f\n", scoshs(FPI/6)); + printf("scoshs(-PI) = %f\n", scoshs(-FPI)); + printf("scoshs(-PI/2) = %f\n", scoshs(-FPI/2)); + printf("scoshs(-PI/3) = %f\n", scoshs(-FPI/3)); + printf("scoshs(-PI/4) = %f\n", scoshs(-FPI/4)); + printf("scoshs(-PI/6) = %f\n", scoshs(-FPI/6)); +} + +void ccoshsTest(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 = ccoshs(pi_pi); + printf("ccoshs(PI + I*PI) = %f + I * %f\n", creals(out), cimags(out)); + out = ccoshs(pi_2_pi_2); + printf("ccoshs(PI/2 + I*PI/2) = %f + I * %f\n", creals(out), cimags(out)); + out = ccoshs(pi_2_pi_3); + printf("ccoshs(PI/2 + I*PI/3) = %f + I * %f\n", creals(out), cimags(out)); + out = ccoshs(pi_2_pi_4); + printf("ccoshs(PI/2 + I*PI/4) = %f + I * %f\n", creals(out), cimags(out)); +} + +void scoshaTest(void) { + float out[5]; + float in[5] = {FPI, FPI/2, FPI/3, FPI/4, FPI/6}; + int i = 0; + + printf(">> Float array\n"); + scosha(in, 5, out); + for (i = 0 ; i < 5 ; ++i) + printf("scosha(array) = %f\n", out[i]); +} + +void ccoshaTest(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); + + ccosha(in, 4, out); + printf(">> Float Complex Array\n"); + for (i = 0 ; i < 4 ; ++i) + printf("ccosha(array) = %e + I * %e\n", creals(out[i]), cimags(out[i])); +} + +int testCosh(void) { + printf("\n>>>> Hyperbolic Cosine Tests\n"); + scoshsTest(); + ccoshsTest(); + scoshaTest(); + ccoshaTest(); + return 0; +} + +int main(void) { + assert(testCosh() == 0); + return 0; +} |