summaryrefslogtreecommitdiff
path: root/src/c/elementaryFunctions/pmodulo
diff options
context:
space:
mode:
Diffstat (limited to 'src/c/elementaryFunctions/pmodulo')
-rw-r--r--src/c/elementaryFunctions/pmodulo/dpmoduloa.c32
-rw-r--r--src/c/elementaryFunctions/pmodulo/dpmodulos.c54
-rw-r--r--src/c/elementaryFunctions/pmodulo/i16pmoduloa.c33
-rw-r--r--src/c/elementaryFunctions/pmodulo/i16pmodulos.c55
-rw-r--r--src/c/elementaryFunctions/pmodulo/spmoduloa.c32
-rw-r--r--src/c/elementaryFunctions/pmodulo/spmodulos.c54
6 files changed, 260 insertions, 0 deletions
diff --git a/src/c/elementaryFunctions/pmodulo/dpmoduloa.c b/src/c/elementaryFunctions/pmodulo/dpmoduloa.c
new file mode 100644
index 0000000..0817987
--- /dev/null
+++ b/src/c/elementaryFunctions/pmodulo/dpmoduloa.c
@@ -0,0 +1,32 @@
+/* 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: Abhinav Dronamraju
+ Organization: FOSSEE, IIT Bombay
+ Email: toolbox@scilab.in
+*/
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <math.h>
+#include "pmodulo.h"
+#include "types.h"
+void dpmoduloa(double* inp1, int size, double* inp2, double* out)
+{
+
+
+ for(int i=0; i< size; i++)
+ {
+
+ out[i]= dpmodulos(inp1[i], inp2[i]);
+
+ }
+
+
+
+
+}
diff --git a/src/c/elementaryFunctions/pmodulo/dpmodulos.c b/src/c/elementaryFunctions/pmodulo/dpmodulos.c
new file mode 100644
index 0000000..6144177
--- /dev/null
+++ b/src/c/elementaryFunctions/pmodulo/dpmodulos.c
@@ -0,0 +1,54 @@
+/* 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: Abhinav Dronamraju
+ Organization: FOSSEE, IIT Bombay
+ Email: toolbox@scilab.in
+*/
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <math.h>
+#include "pmodulo.h"
+#include "types.h"
+
+double dpmodulos(double inp1, double inp2)
+{
+ if( inp1>0 && inp2>0)
+
+ {
+ return fmod(inp1,inp2);
+
+ }
+
+
+ if( inp1>0 && inp2<0)
+
+ {
+
+ return fmod(inp1,inp2);
+
+ }
+
+
+ if(inp1<0 && inp2>0)
+
+ {
+
+ return ((fmod(inp1,inp2))+(inp2));
+
+
+ }
+
+ if(inp1<0 && inp2<0)
+ {
+
+ return ((fmod(inp1,inp2))-(inp2));
+
+ }
+
+}
diff --git a/src/c/elementaryFunctions/pmodulo/i16pmoduloa.c b/src/c/elementaryFunctions/pmodulo/i16pmoduloa.c
new file mode 100644
index 0000000..bb76d7f
--- /dev/null
+++ b/src/c/elementaryFunctions/pmodulo/i16pmoduloa.c
@@ -0,0 +1,33 @@
+/* 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: Abhinav Dronamraju
+ Organization: FOSSEE, IIT Bombay
+ Email: toolbox@scilab.in
+*/
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <math.h>
+#include "int16.h"
+#include "pmodulo.h"
+#include "types.h"
+void i16pmoduloa(int16* inp1, int size, int16* inp2, int16* out)
+{
+
+
+ for(int i=0; i< size; i++)
+ {
+
+ out[i]= i16pmodulos(inp1[i], inp2[i]);
+
+ }
+
+
+
+
+}
diff --git a/src/c/elementaryFunctions/pmodulo/i16pmodulos.c b/src/c/elementaryFunctions/pmodulo/i16pmodulos.c
new file mode 100644
index 0000000..f7f86c5
--- /dev/null
+++ b/src/c/elementaryFunctions/pmodulo/i16pmodulos.c
@@ -0,0 +1,55 @@
+/* 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: Abhinav Dronamraju
+ Organization: FOSSEE, IIT Bombay
+ Email: toolbox@scilab.in
+*/
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <math.h>
+#include "int16.h"
+#include "pmodulo.h"
+#include "types.h"
+
+int16 i16pmodulos(int16 inp1, int16 inp2)
+{
+ if( inp1>0 && inp2>0)
+
+ {
+ return inp1%inp2;
+
+ }
+
+
+ if( inp1>0 && inp2<0)
+
+ {
+
+ return inp1%inp2;
+
+ }
+
+
+ if(inp1<0 && inp2>0)
+
+ {
+
+ return ((inp1%inp2)+(inp2));
+
+
+ }
+
+ if(inp1<0 && inp2<0)
+ {
+
+ return ((inp1%inp2)-(inp2));
+
+ }
+
+}
diff --git a/src/c/elementaryFunctions/pmodulo/spmoduloa.c b/src/c/elementaryFunctions/pmodulo/spmoduloa.c
new file mode 100644
index 0000000..87b2a2f
--- /dev/null
+++ b/src/c/elementaryFunctions/pmodulo/spmoduloa.c
@@ -0,0 +1,32 @@
+/* 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: Abhinav Dronamraju
+ Organization: FOSSEE, IIT Bombay
+ Email: toolbox@scilab.in
+*/
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <math.h>
+#include "pmodulo.h"
+#include "types.h"
+void spmoduloa(float* inp1, int size, float* inp2, float* out)
+{
+
+
+ for(int i=0; i< size; i++)
+ {
+
+ out[i]= spmodulos(inp1[i], inp2[i]);
+
+ }
+
+
+
+
+}
diff --git a/src/c/elementaryFunctions/pmodulo/spmodulos.c b/src/c/elementaryFunctions/pmodulo/spmodulos.c
new file mode 100644
index 0000000..9ab6bc4
--- /dev/null
+++ b/src/c/elementaryFunctions/pmodulo/spmodulos.c
@@ -0,0 +1,54 @@
+/* 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: Abhinav Dronamraju
+ Organization: FOSSEE, IIT Bombay
+ Email: toolbox@scilab.in
+*/
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <math.h>
+#include "pmodulo.h"
+#include "types.h"
+
+float spmodulos(float inp1, float inp2)
+{
+ if( inp1>0 && inp2>0)
+
+ {
+ return fmod(inp1,inp2);
+
+ }
+
+
+ if( inp1>0 && inp2<0)
+
+ {
+
+ return fmod(inp1,inp2);
+
+ }
+
+
+ if(inp1<0 && inp2>0)
+
+ {
+
+ return ((fmod(inp1,inp2))+(inp2));
+
+
+ }
+
+ if(inp1<0 && inp2<0)
+ {
+
+ return ((fmod(inp1,inp2))-(inp2));
+
+ }
+
+}