summaryrefslogtreecommitdiff
path: root/2.3-1/src/c/elementaryFunctions/discrete_mathematics
diff options
context:
space:
mode:
authorSiddhesh Wani2017-05-04 16:15:18 +0530
committerSiddhesh Wani2017-05-04 16:15:18 +0530
commitde82d12658979cd70439f977742f80fac9f6521f (patch)
treeeff661402e749b2402f5576271aefddd42be23fe /2.3-1/src/c/elementaryFunctions/discrete_mathematics
parent472b2e7ebbd2d8b3ecd00b228128aa8a0bd3f920 (diff)
downloadScilab2C-de82d12658979cd70439f977742f80fac9f6521f.tar.gz
Scilab2C-de82d12658979cd70439f977742f80fac9f6521f.tar.bz2
Scilab2C-de82d12658979cd70439f977742f80fac9f6521f.zip
Basic functions and image processing working with MSVC on windows x64
Diffstat (limited to '2.3-1/src/c/elementaryFunctions/discrete_mathematics')
-rw-r--r--2.3-1/src/c/elementaryFunctions/discrete_mathematics/factor/dfactors.c9
-rw-r--r--2.3-1/src/c/elementaryFunctions/discrete_mathematics/factor/sfactors.c13
2 files changed, 8 insertions, 14 deletions
diff --git a/2.3-1/src/c/elementaryFunctions/discrete_mathematics/factor/dfactors.c b/2.3-1/src/c/elementaryFunctions/discrete_mathematics/factor/dfactors.c
index 98019431..9ac76b5a 100644
--- a/2.3-1/src/c/elementaryFunctions/discrete_mathematics/factor/dfactors.c
+++ b/2.3-1/src/c/elementaryFunctions/discrete_mathematics/factor/dfactors.c
@@ -18,17 +18,15 @@ void dfactors(double in,double* out)
int n=(int)in;
while (n%2 == 0)
{
- //printf("%d ", 2);
- out[k++]=2;
+ out[k++]=2;
n = n/2;
}
- for (i = 3; i <= sqrt(n); i = i+2)
+ for (i = 3; i <= (int)sqrt((double)n); i = i+2)
{
while (n%i == 0)
{
- out[k++]=i;
- //printf("%d ", i);
+ out[k++]=i;
n = n/i;
}
}
@@ -36,7 +34,6 @@ void dfactors(double in,double* out)
if (n > 2)
{
out[k++]=n;
- //printf ("%d ", n);
}
}
diff --git a/2.3-1/src/c/elementaryFunctions/discrete_mathematics/factor/sfactors.c b/2.3-1/src/c/elementaryFunctions/discrete_mathematics/factor/sfactors.c
index 2e5ba478..a2eed09f 100644
--- a/2.3-1/src/c/elementaryFunctions/discrete_mathematics/factor/sfactors.c
+++ b/2.3-1/src/c/elementaryFunctions/discrete_mathematics/factor/sfactors.c
@@ -18,25 +18,22 @@ void sfactors(float in,float* out)
int n=(int)in;
while (n%2 == 0)
{
- //printf("%d ", 2);
- out[k++]=2;
+ out[k++]=2;
n = n/2;
}
- for (i = 3; i <= sqrt(n); i = i+2)
+ for (i = 3; i <= (int)sqrt((double)n); i = i+2)
{
while (n%i == 0)
{
- out[k++]=i;
- //printf("%d ", i);
+ out[k++]=i;
n = n/i;
}
}
- if (n > 2)
+ if (n > 2)
{
out[k++]=n;
- //printf ("%d ", n);
- }
+ }
}