Post Reply 
Understanding variables relative to the current active App
01-05-2014, 07:45 PM
Post: #8
RE: Understanding variables relative to the current active App
(01-05-2014 07:31 PM)Michael de Estrada Wrote:  Actually, your code would not be useful for the program I'm using, since the variables are dummies used in calls to the CAS solver, where trig and hyperbolic functions are used that require radians mode. I know that I can use a complicated workaround, but why should I have to do this ?

You don't have to. It's just my own person preference not to ever touch a user's settings. I have had to many students complain to me that they aren't getting the right results because they ran some program that changed their angle settings. The most egregious cases were games (on the HP48) that took over interrupts and left the user's clock and date completely time-shifted!

Anyway, you can always just force the angle mode to whatever you want -- just please make your program also re-instate the user's settings. Does the following work in your case?

Code:

LOCAL usrang=AAngle; // back up user settings
AAngle:=1; // set radian mode; non-zero value also overrides HAngle

// do your stuff here

AAngle:=usrang; // restore user angle mode

You can even encapsulate this into a "wrapper":

Code:

// usage: RUNRAD("Program(arg1, arg2)")
EXPORT RUNRAD( prg );
  LOCAL usrang=AAngle;
  AAngle:=1;
  EXPR(prg);
  AAngle:=usrang;
END;

The only issue here is if the user presses the [On] key to interrupt the program, then AAngle may not be restored properly.

Quote:Personally, I think the way the Prime operates creates unnecessary confusion and complexity.

While I do think the Prime does have a bit of complexity to it, I think this particular issue is fairly easy to understand once you get accustomed to the fact that an app is always in view, and the hierarchy of AAngle and HAngle.

Graph 3D | QPI | SolveSys
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
RE: Understanding variables relative to the current active App - Han - 01-05-2014 07:45 PM



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