Skip to content

Commit 51618b2

Browse files
committed
COMMON: fix problem with SEQ command
1 parent 25e1167 commit 51618b2

File tree

3 files changed

+9
-5
lines changed

3 files changed

+9
-5
lines changed

ChangeLog

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
2018-08-08 (0.12.13)
2+
COMMON: fix problem with SEQ command
3+
14
2018-08-08 (0.12.13)
25
ANDROID: remove hardcoded references to "/sdcard" path
36

samples/distro-examples/tests/strings.bas

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -171,4 +171,6 @@ end
171171
cmd_str1("")
172172
cmd_str1(0)
173173

174+
expect = [0,0.26179938779915,0.5235987755983,0.78539816339745,1.0471975511966,1.30899693899575,1.5707963267949,1.83259571459405,2.0943951023932,2.35619449019234,2.61799387799149,2.87979326579064,3.14159265358979,3.40339204138894,3.66519142918809,3.92699081698724,4.18879020478639,4.45058959258554,4.71238898038469,4.97418836818384,5.23598775598299,5.49778714378214,5.75958653158129,6.02138591938044,6.28318530717958]
175+
if expect != seq(0, 2*pi, 360/15+1) then throw "SEQ error"
174176

src/common/blib_func.c

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2857,18 +2857,17 @@ void cmd_genfunc(long funcCode, var_t *r) {
28572857
//
28582858
case kwSEQ: {
28592859
var_int_t count;
2860-
var_num_t xmin, xmax, dx;
2861-
2860+
var_num_t xmin, xmax;
28622861
par_massget("FFI", &xmin, &xmax, &count);
2863-
28642862
if (!prog_error) {
28652863
// create the array
28662864
if (count > 1) {
28672865
v_toarray1(r, count);
2868-
dx = (xmax - xmin) / (count - 1);
2866+
var_num_t dx = (xmax - xmin) / (count - 1);
2867+
var_num_t x = xmin;
28692868

28702869
// add the entries
2871-
for (int i = 0, x = xmin; i < count; i++, x += dx) {
2870+
for (int i = 0; i < count; i++, x += dx) {
28722871
var_t *elem_p = v_elem(r, i);
28732872
elem_p->type = V_NUM;
28742873
elem_p->v.n = x;

0 commit comments

Comments
 (0)