diff options
author | jofret | 2010-02-05 17:13:22 +0000 |
---|---|---|
committer | jofret | 2010-02-05 17:13:22 +0000 |
commit | 7b531d8fc21340385467e6324edffd373a95fef2 (patch) | |
tree | d8685939b015313b5d3f2148cfaf757116aa639c | |
parent | f13cc7adf5e2ef9e4271f12834df675943a39811 (diff) | |
download | scilab2c-7b531d8fc21340385467e6324edffd373a95fef2.tar.gz scilab2c-7b531d8fc21340385467e6324edffd373a95fef2.tar.bz2 scilab2c-7b531d8fc21340385467e6324edffd373a95fef2.zip |
Correct implementation
-rw-r--r-- | scilab2c/src/c/implicitList/dimplicitLists.c | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/scilab2c/src/c/implicitList/dimplicitLists.c b/scilab2c/src/c/implicitList/dimplicitLists.c index d3908ed2..1c7753f8 100644 --- a/scilab2c/src/c/implicitList/dimplicitLists.c +++ b/scilab2c/src/c/implicitList/dimplicitLists.c @@ -10,33 +10,33 @@ * */ +#include <math.h> #include "implicitList.h" void dimplicitLists(double start, double step, double end, double *out) { int i = 0; + int iNbElements = 0; if (start <= end) { if (start < start + step) { - while (start <= end) - { - out[i] = start; - start += step; - ++i; - } + iNbElements = floor((end - start) / step) + 1; + out[0] = start; } } else { if (start > start + step) { - while (start >= end) - { - out[i] = start; - start += step; - ++i; - } + iNbElements = floor((start - end) / step) + 1; + out[0] = start; } } + + for (i = 1 ; i < iNbElements ; ++i) + { + start += step; + out[i] = start; + } } |