summaryrefslogtreecommitdiff
path: root/src/elementaryFunctions/cosh/dcoshs.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/elementaryFunctions/cosh/dcoshs.c')
-rw-r--r--src/elementaryFunctions/cosh/dcoshs.c28
1 files changed, 18 insertions, 10 deletions
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));
}