diff options
author | jofret | 2010-02-05 17:13:22 +0000 |
---|---|---|
committer | jofret | 2010-02-05 17:13:22 +0000 |
commit | ea4751b5492943fe193eac970d8504827532e03f (patch) | |
tree | b827d8224b83e95776d7e80d959a37673b6acb1d /src | |
parent | f1ed8443c3e768fe0215ec604ab548adaa7fd2c7 (diff) | |
download | scilab2c-ea4751b5492943fe193eac970d8504827532e03f.tar.gz scilab2c-ea4751b5492943fe193eac970d8504827532e03f.tar.bz2 scilab2c-ea4751b5492943fe193eac970d8504827532e03f.zip |
Correct implementation
Diffstat (limited to 'src')
-rw-r--r-- | src/c/implicitList/dimplicitLists.c | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/src/c/implicitList/dimplicitLists.c b/src/c/implicitList/dimplicitLists.c index d3908ed2..1c7753f8 100644 --- a/src/c/implicitList/dimplicitLists.c +++ b/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; + } } |