CAS programs, order of LOCAL variables?
|
12-10-2016, 09:13 PM
Post: #1
|
|||
|
|||
CAS programs, order of LOCAL variables?
Something strange is happening depending on the order of LOCAL declarations in CAS programs. For example,
#cas TEST(k):= BEGIN LOCAL a:=1,j FOR j FROM 2 to k DO IF odd(j) THEN a:=a+1/(2*j-1); ELSE a:=a-1/(2*j-1); END; END; RETURN a; END; #end is unstable, and returns different results for the same input, and j and a get written into the CAS Vars catalog. However, changing the LOCAL declaration works, e.g. ... LOCAL j,a:=1 ... runs OK. So, if a variable has been declared and defined a value, should a subsequent variable not appear on the same LOCAL statement? BTW, this doesn't seem to be a problem with LOCAL statements in Home programs. |
|||
« Next Oldest | Next Newest »
|
Messages In This Thread |
CAS programs, order of LOCAL variables? - Helge Gabert - 12-10-2016 09:13 PM
RE: CAS programs, order of LOCAL variables? - DrD - 12-10-2016, 09:20 PM
RE: CAS programs, order of LOCAL variables? - Arno K - 12-10-2016, 09:59 PM
RE: CAS programs, order of LOCAL variables? - Han - 12-10-2016, 09:47 PM
RE: CAS programs, order of LOCAL variables? - Helge Gabert - 12-11-2016, 12:23 AM
RE: CAS programs, order of LOCAL variables? - Helge Gabert - 12-11-2016, 02:54 AM
RE: CAS programs, order of LOCAL variables? - parisse - 12-11-2016, 07:00 PM
RE: CAS programs, order of LOCAL variables? - Helge Gabert - 12-11-2016, 10:41 PM
|
User(s) browsing this thread: 1 Guest(s)