diff options
Diffstat (limited to 'src/elementaryFunctions')
-rw-r--r-- | src/elementaryFunctions/cosh/Makefile.am | 8 | ||||
-rw-r--r-- | src/elementaryFunctions/cosh/Makefile.in | 13 | ||||
-rw-r--r-- | src/elementaryFunctions/cosh/ccosha.c | 20 | ||||
-rw-r--r-- | src/elementaryFunctions/cosh/ccoshs.c | 24 | ||||
-rw-r--r-- | src/elementaryFunctions/cosh/dcosha.c | 20 | ||||
-rw-r--r-- | src/elementaryFunctions/cosh/dcoshs.c | 28 | ||||
-rw-r--r-- | src/elementaryFunctions/cosh/scosha.c | 20 | ||||
-rw-r--r-- | src/elementaryFunctions/cosh/scoshs.c | 10 | ||||
-rw-r--r-- | src/elementaryFunctions/cosh/testCosh.h | 20 | ||||
-rw-r--r-- | src/elementaryFunctions/cosh/zcosha.c | 20 | ||||
-rw-r--r-- | src/elementaryFunctions/cosh/zcoshs.c | 26 |
11 files changed, 117 insertions, 92 deletions
diff --git a/src/elementaryFunctions/cosh/Makefile.am b/src/elementaryFunctions/cosh/Makefile.am index d3a80988..708d1de4 100644 --- a/src/elementaryFunctions/cosh/Makefile.am +++ b/src/elementaryFunctions/cosh/Makefile.am @@ -10,8 +10,9 @@ ## ## -libCosh_la_CFLAGS = -I ../../type \ - -I ../includes +libCosh_la_CFLAGS = -I $(top_builddir)/type \ + -I $(top_builddir)/auxiliaryFunctions/includes \ + -I $(top_builddir)/elementaryFunctions/includes instdir = $(top_builddir)/lib @@ -43,6 +44,9 @@ check_LDADD = $(top_builddir)/type/libDoubleComplex.la \ $(top_builddir)/elementaryFunctions/cos/libCos.la \ $(top_builddir)/elementaryFunctions/sinh/libSinh.la \ $(top_builddir)/elementaryFunctions/sin/libSin.la \ + $(top_builddir)/elementaryFunctions/exp/libExp.la \ + $(top_builddir)/elementaryFunctions/sqrt/libSqrt.la \ + $(top_builddir)/auxiliaryFunctions/abs/libAbs.la \ @LIBMATH@ check_PROGRAMS = testFloatCosh testDoubleCosh diff --git a/src/elementaryFunctions/cosh/Makefile.in b/src/elementaryFunctions/cosh/Makefile.in index 787c533f..460ce81a 100644 --- a/src/elementaryFunctions/cosh/Makefile.in +++ b/src/elementaryFunctions/cosh/Makefile.in @@ -69,7 +69,10 @@ am__DEPENDENCIES_1 = $(top_builddir)/type/libDoubleComplex.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 + $(top_builddir)/elementaryFunctions/sin/libSin.la \ + $(top_builddir)/elementaryFunctions/exp/libExp.la \ + $(top_builddir)/elementaryFunctions/sqrt/libSqrt.la \ + $(top_builddir)/auxiliaryFunctions/abs/libAbs.la testDoubleCosh_DEPENDENCIES = $(am__DEPENDENCIES_1) testDoubleCosh_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(testDoubleCosh_CFLAGS) \ @@ -209,8 +212,9 @@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ -libCosh_la_CFLAGS = -I ../../type \ - -I ../includes +libCosh_la_CFLAGS = -I $(top_builddir)/type \ + -I $(top_builddir)/auxiliaryFunctions/includes \ + -I $(top_builddir)/elementaryFunctions/includes instdir = $(top_builddir)/lib pkglib_LTLIBRARIES = libCosh.la @@ -238,6 +242,9 @@ check_LDADD = $(top_builddir)/type/libDoubleComplex.la \ $(top_builddir)/elementaryFunctions/cos/libCos.la \ $(top_builddir)/elementaryFunctions/sinh/libSinh.la \ $(top_builddir)/elementaryFunctions/sin/libSin.la \ + $(top_builddir)/elementaryFunctions/exp/libExp.la \ + $(top_builddir)/elementaryFunctions/sqrt/libSqrt.la \ + $(top_builddir)/auxiliaryFunctions/abs/libAbs.la \ @LIBMATH@ diff --git a/src/elementaryFunctions/cosh/ccosha.c b/src/elementaryFunctions/cosh/ccosha.c index 62f548f8..57e2ed4d 100644 --- a/src/elementaryFunctions/cosh/ccosha.c +++ b/src/elementaryFunctions/cosh/ccosha.c @@ -1,14 +1,14 @@ /* -** -*- C -*- -** -** ccosha.c -** Made by Bruno JOFRET <bruno.jofret@inria.fr> -** -** Started on Thu Dec 7 14:54:24 2006 jofret -** Last update Mon Oct 22 09:55:37 2007 bruno -** -** Copyright INRIA 2006 -*/ + * 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 "cosh.h" diff --git a/src/elementaryFunctions/cosh/ccoshs.c b/src/elementaryFunctions/cosh/ccoshs.c index 2a2958ac..4504bec9 100644 --- a/src/elementaryFunctions/cosh/ccoshs.c +++ b/src/elementaryFunctions/cosh/ccoshs.c @@ -1,22 +1,20 @@ /* -** -*- C -*- -** -** ccoshs.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:48:08 2007 jofret -** -** Copyright INRIA 2006 -*/ + * 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 "cosh.h" #include "cos.h" /** ch(z) = cos(i.z) */ floatComplex ccoshs(floatComplex z) { - float real = creals(z); - float minusImag = -cimags(z); - return (ccoss(FloatComplex(minusImag, real))); + return (ccoss(FloatComplex(-cimags(z), creals(z)))); } diff --git a/src/elementaryFunctions/cosh/dcosha.c b/src/elementaryFunctions/cosh/dcosha.c index 67c5ac7f..9b8ce3b2 100644 --- a/src/elementaryFunctions/cosh/dcosha.c +++ b/src/elementaryFunctions/cosh/dcosha.c @@ -1,14 +1,14 @@ /* -** -*- C -*- -** -** dcosha.c -** Made by Bruno JOFRET <bruno.jofret@inria.fr> -** -** Started on Thu Dec 7 14:54:56 2006 jofret -** Last update Mon Oct 22 09:55:27 2007 bruno -** -** Copyright INRIA 2006 -*/ + * 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 "cosh.h" diff --git a/src/elementaryFunctions/cosh/dcoshs.c b/src/elementaryFunctions/cosh/dcoshs.c index 83769292..78131389 100644 --- a/src/elementaryFunctions/cosh/dcoshs.c +++ b/src/elementaryFunctions/cosh/dcoshs.c @@ -1,18 +1,26 @@ /* -** -*- C -*- -** -** dcoshs.c -** Made by Bruno JOFRET <bruno.jofret@inria.fr> -** -** Started on Thu Dec 7 12:02:41 2006 jofret -** Last update Fri Apr 20 14:40:59 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 + * + */ + +/* +// cosh(z) = 0.5 (exp(|z|) + exp(-|z|)) +// = 0.5 ( y + 1/y ) with y = exp(|z|) */ #include <math.h> #include "cosh.h" +#include "exp.h" +#include "abs.h" double dcoshs(double x) { - return (cosh(x)); + double y = dexps(dabss(x)); + return (0.5 * (y + 1.0/y)); } diff --git a/src/elementaryFunctions/cosh/scosha.c b/src/elementaryFunctions/cosh/scosha.c index f63c2c61..8ac948a1 100644 --- a/src/elementaryFunctions/cosh/scosha.c +++ b/src/elementaryFunctions/cosh/scosha.c @@ -1,14 +1,14 @@ /* -** -*- C -*- -** -** scosa.c -** Made by Bruno JOFRET <bruno.jofret@inria.fr> -** -** Started on Thu Dec 7 16:03:27 2006 jofret -** Last update Mon Oct 22 09:55:17 2007 bruno -** -** Copyright INRIA 2006 -*/ + * 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 "cosh.h" diff --git a/src/elementaryFunctions/cosh/scoshs.c b/src/elementaryFunctions/cosh/scoshs.c index a42fd27c..3e8a1e18 100644 --- a/src/elementaryFunctions/cosh/scoshs.c +++ b/src/elementaryFunctions/cosh/scoshs.c @@ -10,9 +10,17 @@ * */ +/* +// cosh(z) = 0.5 (exp(|z|) + exp(-|z|)) +// = 0.5 ( y + 1/y ) with y = exp(|z|) +*/ + #include <math.h> #include "cosh.h" +#include "exp.h" +#include "abs.h" float scoshs(float x) { - return (coshf(x)); + float y = sexps(sabss(x)); + return (0.5f * (y + 1.0f / y)); } diff --git a/src/elementaryFunctions/cosh/testCosh.h b/src/elementaryFunctions/cosh/testCosh.h index edd932f7..9ed2d4cb 100644 --- a/src/elementaryFunctions/cosh/testCosh.h +++ b/src/elementaryFunctions/cosh/testCosh.h @@ -1,14 +1,14 @@ /* -** -*- C -*- -** -** testCosh.h -** Made by Bruno JOFRET <bruno.jofret@inria.fr> -** -** Started on Fri Mar 30 11:35:55 2007 jofret -** Last update Wed Apr 18 17:04:57 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 + * + */ #ifndef _TESTCOSH_H_ #define _TESTCOSH_H_ diff --git a/src/elementaryFunctions/cosh/zcosha.c b/src/elementaryFunctions/cosh/zcosha.c index 5c79933e..a7f59136 100644 --- a/src/elementaryFunctions/cosh/zcosha.c +++ b/src/elementaryFunctions/cosh/zcosha.c @@ -1,14 +1,14 @@ /* -** -*- C -*- -** -** zcosha.c -** Made by Bruno JOFRET <bruno.jofret@inria.fr> -** -** Started on Thu Dec 7 16:12:02 2006 jofret -** Last update Mon Oct 22 09:55:03 2007 bruno -** -** Copyright INRIA 2006 -*/ + * 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 "cosh.h" diff --git a/src/elementaryFunctions/cosh/zcoshs.c b/src/elementaryFunctions/cosh/zcoshs.c index d80fd091..a4c072fd 100644 --- a/src/elementaryFunctions/cosh/zcoshs.c +++ b/src/elementaryFunctions/cosh/zcoshs.c @@ -1,21 +1,21 @@ /* -** -*- C -*- -** -** zcoshs.c -** Made by Bruno JOFRET <bruno.jofret@inria.fr> -** -** Started on Thu Dec 7 12:05:48 2006 jofret -** Last update Fri Feb 23 16:48:33 2007 jofret -** -** Copyright INRIA 2006 -*/ + * 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 + * + */ + +/** cosh(z) = cos(i z) */ #include "cosh.h" #include "cos.h" doubleComplex zcoshs(doubleComplex z) { - double real = zreals(z); - double minusImag = -zimags(z); - return (zcoss(DoubleComplex(minusImag, real))); + return (zcoss(DoubleComplex(-zimags(z), zreals(z)))); } |