Post Reply 
Debugging With an Orange Bang
06-30-2017, 01:14 PM
Post: #9
RE: Debugging With an Orange Bang
(06-30-2017 12:26 PM)toml_12953 Wrote:  
(06-30-2017 11:56 AM)Didier Lachieze Wrote:  Now I'm wondering why you use =< here as it works as well with := instead of =< in the lines:

Code:
        c(x) =<  0.5 * m12 / m11; // center of circle
        c(y) =< -0.5 * m13 / m11;

In order for that to work, c has to either be global or be passed by reference. Otherwise modifying the values in c in the function circl won't modify the values in the main program. At least that's what I've found in regular programs. Maybe in CAS programs it's different? If so, I'll be making most of my programs CAS from now on. Thanks for your time and expertise on this!

Ok, I understand now what you're trying to do. But when you call circl with: circl(c,p) the parameters are not passed by reference as described for the xcas functions: "It is not possible to pass arguments by reference, only by value." I don't think it is different on the Prime.

So circl get a copy of c and whatever you do on it with := or =< , this will not change the value of c in the main program. At least this is how I understand it.

You can have c declared as a global variable but in this case it should not be a parameter of circl and then whatever change is done in circl will be visible to the main program but there is no need to use =< for that.
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
Debugging With an Orange Bang - toml_12953 - 06-29-2017, 02:58 AM
RE: Debugging With an Orange Bang - Didier Lachieze - 06-30-2017 01:14 PM



User(s) browsing this thread: 1 Guest(s)