diff options
Diffstat (limited to 'src/elementaryFunctions')
-rw-r--r-- | src/elementaryFunctions/sqrt/Makefile.am | 22 | ||||
-rw-r--r-- | src/elementaryFunctions/sqrt/Makefile.in | 93 | ||||
-rw-r--r-- | src/elementaryFunctions/sqrt/csqrts.c | 22 | ||||
-rw-r--r-- | src/elementaryFunctions/sqrt/ssqrts.c | 22 | ||||
-rw-r--r-- | src/elementaryFunctions/sqrt/testDoubleSqrt.c | 45 | ||||
-rw-r--r-- | src/elementaryFunctions/sqrt/testFloatSqrt.c | 45 | ||||
-rw-r--r-- | src/elementaryFunctions/sqrt/testSqrt.c | 64 | ||||
-rw-r--r-- | src/elementaryFunctions/sqrt/zsqrts.c | 22 |
8 files changed, 199 insertions, 136 deletions
diff --git a/src/elementaryFunctions/sqrt/Makefile.am b/src/elementaryFunctions/sqrt/Makefile.am index 7d8a555e..94e096c3 100644 --- a/src/elementaryFunctions/sqrt/Makefile.am +++ b/src/elementaryFunctions/sqrt/Makefile.am @@ -37,16 +37,22 @@ HEAD = ../includes/sqrt.h check_INCLUDES = -I $(top_builddir)/elementaryFunctions/includes \ -I $(top_builddir)/type -check_PROGRAMS = testSqrt +check_LDADD = $(top_builddir)/type/libDoubleComplex.la \ + $(top_builddir)/type/libFloatComplex.la \ + $(top_builddir)/elementaryFunctions/sqrt/libSqrt.la \ + @LIBMATH@ + +check_PROGRAMS = testFloatSqrt testDoubleSqrt -TESTS = testSqrt +TESTS = testFloatSqrt testDoubleSqrt # # -*- Square Root Tests -*- # -testSqrt_SOURCES = testSqrt.c -testSqrt_CFLAGS = $(check_INCLUDES) -testSqrt_LDADD = $(top_builddir)/type/libDoubleComplex.la \ - $(top_builddir)/type/libFloatComplex.la \ - $(top_builddir)/elementaryFunctions/sqrt/libSqrt.la \ - @LIBMATH@ +testFloatSqrt_SOURCES = testFloatSqrt.c +testFloatSqrt_CFLAGS = $(check_INCLUDES) +testFloatSqrt_LDADD = $(check_LDADD) + +testDoubleSqrt_SOURCES = testDoubleSqrt.c +testDoubleSqrt_CFLAGS = $(check_INCLUDES) +testDoubleSqrt_LDADD = $(check_LDADD) diff --git a/src/elementaryFunctions/sqrt/Makefile.in b/src/elementaryFunctions/sqrt/Makefile.in index e44f2400..f42e265f 100644 --- a/src/elementaryFunctions/sqrt/Makefile.in +++ b/src/elementaryFunctions/sqrt/Makefile.in @@ -32,8 +32,8 @@ PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ -check_PROGRAMS = testSqrt$(EXEEXT) -TESTS = testSqrt$(EXEEXT) +check_PROGRAMS = testFloatSqrt$(EXEEXT) testDoubleSqrt$(EXEEXT) +TESTS = testFloatSqrt$(EXEEXT) testDoubleSqrt$(EXEEXT) subdir = elementaryFunctions/sqrt DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 @@ -62,14 +62,21 @@ libSqrt_la_OBJECTS = $(am_libSqrt_la_OBJECTS) libSqrt_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(libSqrt_la_CFLAGS) \ $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ -am_testSqrt_OBJECTS = testSqrt-testSqrt.$(OBJEXT) -testSqrt_OBJECTS = $(am_testSqrt_OBJECTS) -testSqrt_DEPENDENCIES = $(top_builddir)/type/libDoubleComplex.la \ +am_testDoubleSqrt_OBJECTS = testDoubleSqrt-testDoubleSqrt.$(OBJEXT) +testDoubleSqrt_OBJECTS = $(am_testDoubleSqrt_OBJECTS) +am__DEPENDENCIES_1 = $(top_builddir)/type/libDoubleComplex.la \ $(top_builddir)/type/libFloatComplex.la \ $(top_builddir)/elementaryFunctions/sqrt/libSqrt.la -testSqrt_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ - --mode=link $(CCLD) $(testSqrt_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \ - $(LDFLAGS) -o $@ +testDoubleSqrt_DEPENDENCIES = $(am__DEPENDENCIES_1) +testDoubleSqrt_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=link $(CCLD) $(testDoubleSqrt_CFLAGS) \ + $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ +am_testFloatSqrt_OBJECTS = testFloatSqrt-testFloatSqrt.$(OBJEXT) +testFloatSqrt_OBJECTS = $(am_testFloatSqrt_OBJECTS) +testFloatSqrt_DEPENDENCIES = $(am__DEPENDENCIES_1) +testFloatSqrt_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=link $(CCLD) $(testFloatSqrt_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 = $(libSqrt_la_SOURCES) $(testSqrt_SOURCES) -DIST_SOURCES = $(libSqrt_la_SOURCES) $(testSqrt_SOURCES) +SOURCES = $(libSqrt_la_SOURCES) $(testDoubleSqrt_SOURCES) \ + $(testFloatSqrt_SOURCES) +DIST_SOURCES = $(libSqrt_la_SOURCES) $(testDoubleSqrt_SOURCES) \ + $(testFloatSqrt_SOURCES) ETAGS = etags CTAGS = ctags DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) @@ -218,17 +227,21 @@ HEAD = ../includes/sqrt.h check_INCLUDES = -I $(top_builddir)/elementaryFunctions/includes \ -I $(top_builddir)/type - -# -# -*- Square Root Tests -*- -# -testSqrt_SOURCES = testSqrt.c -testSqrt_CFLAGS = $(check_INCLUDES) -testSqrt_LDADD = $(top_builddir)/type/libDoubleComplex.la \ +check_LDADD = $(top_builddir)/type/libDoubleComplex.la \ $(top_builddir)/type/libFloatComplex.la \ $(top_builddir)/elementaryFunctions/sqrt/libSqrt.la \ @LIBMATH@ + +# +# -*- Square Root Tests -*- +# +testFloatSqrt_SOURCES = testFloatSqrt.c +testFloatSqrt_CFLAGS = $(check_INCLUDES) +testFloatSqrt_LDADD = $(check_LDADD) +testDoubleSqrt_SOURCES = testDoubleSqrt.c +testDoubleSqrt_CFLAGS = $(check_INCLUDES) +testDoubleSqrt_LDADD = $(check_LDADD) all: all-am .SUFFIXES: @@ -298,9 +311,12 @@ clean-checkPROGRAMS: echo " rm -f $$p $$f"; \ rm -f $$p $$f ; \ done -testSqrt$(EXEEXT): $(testSqrt_OBJECTS) $(testSqrt_DEPENDENCIES) - @rm -f testSqrt$(EXEEXT) - $(testSqrt_LINK) $(testSqrt_OBJECTS) $(testSqrt_LDADD) $(LIBS) +testDoubleSqrt$(EXEEXT): $(testDoubleSqrt_OBJECTS) $(testDoubleSqrt_DEPENDENCIES) + @rm -f testDoubleSqrt$(EXEEXT) + $(testDoubleSqrt_LINK) $(testDoubleSqrt_OBJECTS) $(testDoubleSqrt_LDADD) $(LIBS) +testFloatSqrt$(EXEEXT): $(testFloatSqrt_OBJECTS) $(testFloatSqrt_DEPENDENCIES) + @rm -f testFloatSqrt$(EXEEXT) + $(testFloatSqrt_LINK) $(testFloatSqrt_OBJECTS) $(testFloatSqrt_LDADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) @@ -316,7 +332,8 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libSqrt_la-ssqrts.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libSqrt_la-zsqrta.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libSqrt_la-zsqrts.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/testSqrt-testSqrt.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/testDoubleSqrt-testDoubleSqrt.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/testFloatSqrt-testFloatSqrt.Po@am__quote@ .c.o: @am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @@ -395,19 +412,33 @@ libSqrt_la-zsqrta.lo: zsqrta.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) $(libSqrt_la_CFLAGS) $(CFLAGS) -c -o libSqrt_la-zsqrta.lo `test -f 'zsqrta.c' || echo '$(srcdir)/'`zsqrta.c -testSqrt-testSqrt.o: testSqrt.c -@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(testSqrt_CFLAGS) $(CFLAGS) -MT testSqrt-testSqrt.o -MD -MP -MF $(DEPDIR)/testSqrt-testSqrt.Tpo -c -o testSqrt-testSqrt.o `test -f 'testSqrt.c' || echo '$(srcdir)/'`testSqrt.c -@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/testSqrt-testSqrt.Tpo $(DEPDIR)/testSqrt-testSqrt.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='testSqrt.c' object='testSqrt-testSqrt.o' libtool=no @AMDEPBACKSLASH@ +testDoubleSqrt-testDoubleSqrt.o: testDoubleSqrt.c +@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(testDoubleSqrt_CFLAGS) $(CFLAGS) -MT testDoubleSqrt-testDoubleSqrt.o -MD -MP -MF $(DEPDIR)/testDoubleSqrt-testDoubleSqrt.Tpo -c -o testDoubleSqrt-testDoubleSqrt.o `test -f 'testDoubleSqrt.c' || echo '$(srcdir)/'`testDoubleSqrt.c +@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/testDoubleSqrt-testDoubleSqrt.Tpo $(DEPDIR)/testDoubleSqrt-testDoubleSqrt.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='testDoubleSqrt.c' object='testDoubleSqrt-testDoubleSqrt.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) $(testDoubleSqrt_CFLAGS) $(CFLAGS) -c -o testDoubleSqrt-testDoubleSqrt.o `test -f 'testDoubleSqrt.c' || echo '$(srcdir)/'`testDoubleSqrt.c + +testDoubleSqrt-testDoubleSqrt.obj: testDoubleSqrt.c +@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(testDoubleSqrt_CFLAGS) $(CFLAGS) -MT testDoubleSqrt-testDoubleSqrt.obj -MD -MP -MF $(DEPDIR)/testDoubleSqrt-testDoubleSqrt.Tpo -c -o testDoubleSqrt-testDoubleSqrt.obj `if test -f 'testDoubleSqrt.c'; then $(CYGPATH_W) 'testDoubleSqrt.c'; else $(CYGPATH_W) '$(srcdir)/testDoubleSqrt.c'; fi` +@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/testDoubleSqrt-testDoubleSqrt.Tpo $(DEPDIR)/testDoubleSqrt-testDoubleSqrt.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='testDoubleSqrt.c' object='testDoubleSqrt-testDoubleSqrt.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) $(testDoubleSqrt_CFLAGS) $(CFLAGS) -c -o testDoubleSqrt-testDoubleSqrt.obj `if test -f 'testDoubleSqrt.c'; then $(CYGPATH_W) 'testDoubleSqrt.c'; else $(CYGPATH_W) '$(srcdir)/testDoubleSqrt.c'; fi` + +testFloatSqrt-testFloatSqrt.o: testFloatSqrt.c +@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(testFloatSqrt_CFLAGS) $(CFLAGS) -MT testFloatSqrt-testFloatSqrt.o -MD -MP -MF $(DEPDIR)/testFloatSqrt-testFloatSqrt.Tpo -c -o testFloatSqrt-testFloatSqrt.o `test -f 'testFloatSqrt.c' || echo '$(srcdir)/'`testFloatSqrt.c +@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/testFloatSqrt-testFloatSqrt.Tpo $(DEPDIR)/testFloatSqrt-testFloatSqrt.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='testFloatSqrt.c' object='testFloatSqrt-testFloatSqrt.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) $(testSqrt_CFLAGS) $(CFLAGS) -c -o testSqrt-testSqrt.o `test -f 'testSqrt.c' || echo '$(srcdir)/'`testSqrt.c +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(testFloatSqrt_CFLAGS) $(CFLAGS) -c -o testFloatSqrt-testFloatSqrt.o `test -f 'testFloatSqrt.c' || echo '$(srcdir)/'`testFloatSqrt.c -testSqrt-testSqrt.obj: testSqrt.c -@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(testSqrt_CFLAGS) $(CFLAGS) -MT testSqrt-testSqrt.obj -MD -MP -MF $(DEPDIR)/testSqrt-testSqrt.Tpo -c -o testSqrt-testSqrt.obj `if test -f 'testSqrt.c'; then $(CYGPATH_W) 'testSqrt.c'; else $(CYGPATH_W) '$(srcdir)/testSqrt.c'; fi` -@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/testSqrt-testSqrt.Tpo $(DEPDIR)/testSqrt-testSqrt.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='testSqrt.c' object='testSqrt-testSqrt.obj' libtool=no @AMDEPBACKSLASH@ +testFloatSqrt-testFloatSqrt.obj: testFloatSqrt.c +@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(testFloatSqrt_CFLAGS) $(CFLAGS) -MT testFloatSqrt-testFloatSqrt.obj -MD -MP -MF $(DEPDIR)/testFloatSqrt-testFloatSqrt.Tpo -c -o testFloatSqrt-testFloatSqrt.obj `if test -f 'testFloatSqrt.c'; then $(CYGPATH_W) 'testFloatSqrt.c'; else $(CYGPATH_W) '$(srcdir)/testFloatSqrt.c'; fi` +@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/testFloatSqrt-testFloatSqrt.Tpo $(DEPDIR)/testFloatSqrt-testFloatSqrt.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='testFloatSqrt.c' object='testFloatSqrt-testFloatSqrt.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) $(testSqrt_CFLAGS) $(CFLAGS) -c -o testSqrt-testSqrt.obj `if test -f 'testSqrt.c'; then $(CYGPATH_W) 'testSqrt.c'; else $(CYGPATH_W) '$(srcdir)/testSqrt.c'; fi` +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(testFloatSqrt_CFLAGS) $(CFLAGS) -c -o testFloatSqrt-testFloatSqrt.obj `if test -f 'testFloatSqrt.c'; then $(CYGPATH_W) 'testFloatSqrt.c'; else $(CYGPATH_W) '$(srcdir)/testFloatSqrt.c'; fi` mostlyclean-libtool: -rm -f *.lo diff --git a/src/elementaryFunctions/sqrt/csqrts.c b/src/elementaryFunctions/sqrt/csqrts.c index ed1f8345..f39b67f5 100644 --- a/src/elementaryFunctions/sqrt/csqrts.c +++ b/src/elementaryFunctions/sqrt/csqrts.c @@ -1,18 +1,18 @@ /* -** -*- C -*- -** -** csqrts.c -** Made by Bruno JOFRET <bruno.jofret@inria.fr> -** -** Started on Fri Sep 7 11:04:08 2007 bruno -** Last update Fri Sep 7 11:04:56 2007 bruno -** -** 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 "sqrt.h" floatComplex csqrts(floatComplex in) { /* FIXME : Dummy ... */ - return FloatComplex(0, 0); + return in; } diff --git a/src/elementaryFunctions/sqrt/ssqrts.c b/src/elementaryFunctions/sqrt/ssqrts.c index 79442306..541fea2f 100644 --- a/src/elementaryFunctions/sqrt/ssqrts.c +++ b/src/elementaryFunctions/sqrt/ssqrts.c @@ -1,18 +1,18 @@ /* -** -*- C -*- -** -** ssqrts.c -** Made by Bruno JOFRET <bruno.jofret@inria.fr> -** -** Started on Fri Apr 20 10:57:05 2007 jofret -** Last update Mon Apr 23 17:36:16 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 "sqrt.h" float ssqrts(float in) { - return sqrt(in); + return (float) sqrt((float) in); } diff --git a/src/elementaryFunctions/sqrt/testDoubleSqrt.c b/src/elementaryFunctions/sqrt/testDoubleSqrt.c new file mode 100644 index 00000000..8a19c730 --- /dev/null +++ b/src/elementaryFunctions/sqrt/testDoubleSqrt.c @@ -0,0 +1,45 @@ +/* + * 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 "testSqrt.h" + +void dsqrtsTest() { + printf(">> Double scalar\n"); + printf("dsqrts(0) = %e\n", dsqrts(0.0)); + printf("dsqrts(PI) = %e\n", dsqrts(DPI)); + printf("dsqrts(PI/2) = %e\n", dsqrts(DPI/2)); + printf("dsqrts(PI/3) = %e\n", dsqrts(DPI/3)); + printf("dsqrts(PI/4) = %e\n", dsqrts(DPI/4)); + printf("dsqrts(PI/6) = %e\n", dsqrts(DPI/6)); + printf("dsqrts(-PI) = %e\n", dsqrts(-DPI)); + printf("dsqrts(-PI/2) = %e\n", dsqrts(-DPI/2)); + printf("dsqrts(-PI/3) = %e\n", dsqrts(-DPI/3)); + printf("dsqrts(-PI/4) = %e\n", dsqrts(-DPI/4)); + printf("dsqrts(-PI/6) = %e\n", dsqrts(-DPI/6)); +} + +int testSqrt() { + printf("\n>>>> Double Square Root Tests\n"); + dsqrtsTest(); + /* FIXME : Implement some test here ... */ + /* + zsqrtsTest(); + dsqrtaTest(); + zsqrtaTest(); + */ + return 0; +} + +int main() { + assert(testSqrt() == 0); + return 0; +} diff --git a/src/elementaryFunctions/sqrt/testFloatSqrt.c b/src/elementaryFunctions/sqrt/testFloatSqrt.c new file mode 100644 index 00000000..c9854b2b --- /dev/null +++ b/src/elementaryFunctions/sqrt/testFloatSqrt.c @@ -0,0 +1,45 @@ +/* + * 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 "testSqrt.h" + +void ssqrtsTest() { + printf(">> Float scalar\n"); + printf("ssqrts(0) = %f\n", ssqrts(0.0f)); + printf("ssqrts(PI) = %f\n", ssqrts(FPI)); + printf("ssqrts(PI/2) = %f\n", ssqrts(FPI/2)); + printf("ssqrts(PI/3) = %f\n", ssqrts(FPI/3)); + printf("ssqrts(PI/4) = %f\n", ssqrts(FPI/4)); + printf("ssqrts(PI/6) = %f\n", ssqrts(FPI/6)); + printf("ssqrts(-PI) = %f\n", ssqrts(-FPI)); + printf("ssqrts(-PI/2) = %f\n", ssqrts(-FPI/2)); + printf("ssqrts(-PI/3) = %f\n", ssqrts(-FPI/3)); + printf("ssqrts(-PI/4) = %f\n", ssqrts(-FPI/4)); + printf("ssqrts(-PI/6) = %f\n", ssqrts(-FPI/6)); +} + +int testSqrt() { + printf("\n>>>> Float Square Root Tests\n"); + ssqrtsTest(); + /* FIXME : Implement some test here ... */ + /* + csqrtsTest(); + ssqrtaTest(); + csqrtaTest(); + */ + return 0; +} + +int main() { + assert(testSqrt() == 0); + return 0; +} diff --git a/src/elementaryFunctions/sqrt/testSqrt.c b/src/elementaryFunctions/sqrt/testSqrt.c deleted file mode 100644 index c3bbddbe..00000000 --- a/src/elementaryFunctions/sqrt/testSqrt.c +++ /dev/null @@ -1,64 +0,0 @@ -/* -** -*- C -*- -** -** testSqrt.c -** Made by Bruno JOFRET <bruno.jofret@inria.fr> -** -** Started on Fri Dec 8 15:06:16 2006 jofret -** Last update Fri Apr 20 10:53:23 2007 jofret -** -** Copyright INRIA 2006 -*/ - -#include "testSqrt.h" - -void ssqrtsTest() { - printf(">> Float scalar\n"); - printf("ssqrts(0) = %f\n", ssqrts((float) 0)); - printf("ssqrts(PI) = %f\n", ssqrts(PI)); - printf("ssqrts(PI/2) = %f\n", ssqrts(PI/2)); - printf("ssqrts(PI/3) = %f\n", ssqrts(PI/3)); - printf("ssqrts(PI/4) = %f\n", ssqrts(PI/4)); - printf("ssqrts(PI/6) = %f\n", ssqrts(PI/6)); - printf("ssqrts(-PI) = %f\n", ssqrts(-PI)); - printf("ssqrts(-PI/2) = %f\n", ssqrts(-PI/2)); - printf("ssqrts(-PI/3) = %f\n", ssqrts(-PI/3)); - printf("ssqrts(-PI/4) = %f\n", ssqrts(-PI/4)); - printf("ssqrts(-PI/6) = %f\n", ssqrts(-PI/6)); -} - -void dsqrtsTest() { - printf(">> Double scalar\n"); - printf("dsqrts(0) = %e\n", dsqrts((double) 0)); - printf("dsqrts(PI) = %e\n", dsqrts(PI)); - printf("dsqrts(PI/2) = %e\n", dsqrts(PI/2)); - printf("dsqrts(PI/3) = %e\n", dsqrts(PI/3)); - printf("dsqrts(PI/4) = %e\n", dsqrts(PI/4)); - printf("dsqrts(PI/6) = %e\n", dsqrts(PI/6)); - printf("dsqrts(-PI) = %e\n", dsqrts(-PI)); - printf("dsqrts(-PI/2) = %e\n", dsqrts(-PI/2)); - printf("dsqrts(-PI/3) = %e\n", dsqrts(-PI/3)); - printf("dsqrts(-PI/4) = %e\n", dsqrts(-PI/4)); - printf("dsqrts(-PI/6) = %e\n", dsqrts(-PI/6)); -} - -int testSqrt() { - printf("\n>>>> Square Root Tests\n"); - ssqrtsTest(); - dsqrtsTest(); - /* FIXME : Implement some test here ... */ - /* - csqrtsTest(); - zsqrtsTest(); - ssqrtaTest(); - dsqrtaTest(); - csqrtaTest(); - zsqrtaTest(); - */ - return 0; -} - -int main() { - assert(testSqrt() == 0); - return 0; -} diff --git a/src/elementaryFunctions/sqrt/zsqrts.c b/src/elementaryFunctions/sqrt/zsqrts.c index 9d01b432..05d9192e 100644 --- a/src/elementaryFunctions/sqrt/zsqrts.c +++ b/src/elementaryFunctions/sqrt/zsqrts.c @@ -1,18 +1,18 @@ /* -** -*- C -*- -** -** zsqrts.c -** Made by Bruno JOFRET <bruno.jofret@inria.fr> -** -** Started on Fri Sep 7 11:05:10 2007 bruno -** Last update Fri Sep 7 11:05:48 2007 bruno -** -** 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 "sqrt.h" doubleComplex zsqrts(doubleComplex in) { /* FIXME : Dummy ... */ - return DoubleComplex(0, 0); + return in; } |