summaryrefslogtreecommitdiff
path: root/src/c/elementaryFunctions/cosh
diff options
context:
space:
mode:
Diffstat (limited to 'src/c/elementaryFunctions/cosh')
-rw-r--r--src/c/elementaryFunctions/cosh/i16cosha.c20
-rw-r--r--src/c/elementaryFunctions/cosh/i16coshs.c27
-rw-r--r--src/c/elementaryFunctions/cosh/i8cosha.c20
-rw-r--r--src/c/elementaryFunctions/cosh/i8coshs.c27
-rw-r--r--src/c/elementaryFunctions/cosh/u16cosha.c20
-rw-r--r--src/c/elementaryFunctions/cosh/u16coshs.c26
-rw-r--r--src/c/elementaryFunctions/cosh/u8cosha.c20
-rw-r--r--src/c/elementaryFunctions/cosh/u8coshs.c27
8 files changed, 187 insertions, 0 deletions
diff --git a/src/c/elementaryFunctions/cosh/i16cosha.c b/src/c/elementaryFunctions/cosh/i16cosha.c
new file mode 100644
index 00000000..edb56f9c
--- /dev/null
+++ b/src/c/elementaryFunctions/cosh/i16cosha.c
@@ -0,0 +1,20 @@
+/* Copyright (C) 2016 - IIT Bombay - FOSSEE
+
+ 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
+ Author: Siddhesh Wani
+ Organization: FOSSEE, IIT Bombay
+ Email: toolbox@scilab.in
+*/
+
+#include "cosh.h"
+
+void i16cosha(int16* x, int size, int16* y) {
+ int i = 0;
+ for (i = 0; i < size; ++i) {
+ y[i] = i16coshs(x[i]);
+ }
+}
diff --git a/src/c/elementaryFunctions/cosh/i16coshs.c b/src/c/elementaryFunctions/cosh/i16coshs.c
new file mode 100644
index 00000000..10d3eb95
--- /dev/null
+++ b/src/c/elementaryFunctions/cosh/i16coshs.c
@@ -0,0 +1,27 @@
+/* Copyright (C) 2016 - IIT Bombay - FOSSEE
+
+ 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
+ Author: Siddhesh Wani
+ Organization: FOSSEE, IIT Bombay
+ Email: toolbox@scilab.in
+*/
+
+/*
+// 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"
+#include "types.h"
+
+float i16coshs(int16 x) {
+ double y = i16exps(i16abss(x));
+ return (0.5 * (y + 1.0/y));
+}
diff --git a/src/c/elementaryFunctions/cosh/i8cosha.c b/src/c/elementaryFunctions/cosh/i8cosha.c
new file mode 100644
index 00000000..4ec75920
--- /dev/null
+++ b/src/c/elementaryFunctions/cosh/i8cosha.c
@@ -0,0 +1,20 @@
+/* Copyright (C) 2016 - IIT Bombay - FOSSEE
+
+ 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
+ Author: Siddhesh Wani
+ Organization: FOSSEE, IIT Bombay
+ Email: toolbox@scilab.in
+*/
+
+#include "cosh.h"
+
+void i8cosha(int8* x, int size, int8* y) {
+ int i = 0;
+ for (i = 0; i < size; ++i) {
+ y[i] = i8coshs(x[i]);
+ }
+}
diff --git a/src/c/elementaryFunctions/cosh/i8coshs.c b/src/c/elementaryFunctions/cosh/i8coshs.c
new file mode 100644
index 00000000..bc301221
--- /dev/null
+++ b/src/c/elementaryFunctions/cosh/i8coshs.c
@@ -0,0 +1,27 @@
+/* Copyright (C) 2016 - IIT Bombay - FOSSEE
+
+ 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
+ Author: Siddhesh Wani
+ Organization: FOSSEE, IIT Bombay
+ Email: toolbox@scilab.in
+*/
+
+/*
+// 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"
+#include "types.h"
+
+float i8coshs(int8 x) {
+ double y = i8exps(i8abss(x));
+ return (0.5 * (y + 1.0/y));
+}
diff --git a/src/c/elementaryFunctions/cosh/u16cosha.c b/src/c/elementaryFunctions/cosh/u16cosha.c
new file mode 100644
index 00000000..83d3786c
--- /dev/null
+++ b/src/c/elementaryFunctions/cosh/u16cosha.c
@@ -0,0 +1,20 @@
+/* Copyright (C) 2016 - IIT Bombay - FOSSEE
+
+ 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
+ Author: Siddhesh Wani
+ Organization: FOSSEE, IIT Bombay
+ Email: toolbox@scilab.in
+*/
+
+#include "cosh.h"
+
+void u16cosha(uint16* x, int size, uint16* y) {
+ int i = 0;
+ for (i = 0; i < size; ++i) {
+ y[i] = u16coshs(x[i]);
+ }
+}
diff --git a/src/c/elementaryFunctions/cosh/u16coshs.c b/src/c/elementaryFunctions/cosh/u16coshs.c
new file mode 100644
index 00000000..22f6ded0
--- /dev/null
+++ b/src/c/elementaryFunctions/cosh/u16coshs.c
@@ -0,0 +1,26 @@
+/* Copyright (C) 2016 - IIT Bombay - FOSSEE
+
+ 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
+ Organization: FOSSEE, IIT Bombay
+ Email: toolbox@scilab.in
+*/
+
+/*
+// 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"
+#include "types.h"
+
+float u16coshs(uint16 x) {
+ double y = u16exps(u16abss(x));
+ return (0.5 * (y + 1.0/y));
+}
diff --git a/src/c/elementaryFunctions/cosh/u8cosha.c b/src/c/elementaryFunctions/cosh/u8cosha.c
new file mode 100644
index 00000000..4b44c28b
--- /dev/null
+++ b/src/c/elementaryFunctions/cosh/u8cosha.c
@@ -0,0 +1,20 @@
+/* Copyright (C) 2016 - IIT Bombay - FOSSEE
+
+ 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
+ Author: Siddhesh Wani
+ Organization: FOSSEE, IIT Bombay
+ Email: toolbox@scilab.in
+*/
+
+#include "cosh.h"
+
+void u8cosha(uint8* x, int size, uint8* y) {
+ int i = 0;
+ for (i = 0; i < size; ++i) {
+ y[i] = u8coshs(x[i]);
+ }
+}
diff --git a/src/c/elementaryFunctions/cosh/u8coshs.c b/src/c/elementaryFunctions/cosh/u8coshs.c
new file mode 100644
index 00000000..bed1eb93
--- /dev/null
+++ b/src/c/elementaryFunctions/cosh/u8coshs.c
@@ -0,0 +1,27 @@
+/* Copyright (C) 2016 - IIT Bombay - FOSSEE
+
+ 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
+ Author: Siddhesh Wani
+ Organization: FOSSEE, IIT Bombay
+ Email: toolbox@scilab.in
+*/
+
+/*
+// 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"
+#include "types.h"
+
+float u8coshs(uint8 x) {
+ double y = u8exps(u8abss(x));
+ return (0.5 * (y + 1.0/y));
+}