Post Reply 
multi criteria IF statement
06-13-2021, 05:35 AM
Post: #9
RE: multi criteria IF statement
(06-12-2021 11:53 AM)Albert Chan Wrote:  
(06-12-2021 03:05 AM)Dougggg Wrote:  there is a system varable HAngle you can set to 0 for radian and 1 for degrees, by default it is set in the setup screen or app

On HP Prime emulator, HAngle cannot be set to 0 in CAS (Why?)

CAS> HAngle := 0       → "HAngle(0) Error: Bad Argument Value"

It might be better to use AAngle instead, see http://edspi31415.blogspot.com/2018/02/h...mcalc.html

Code:
EXPORT bearing(x,y) // x=north, y=east
BEGIN
IF x = 0 THEN       // avoid divide-by-0
    y := sign(y)*90;
ELSE
    AAngle := 2;    // degree mode
    y := atan(y/x) + (x<0)*180;
    AAngle := 0;    // restore
END;
return →HMS(y MOD 360);
END;

(06-11-2021 02:04 PM)toml_12953 Wrote:  Why write a function when one is already built in?

look up ARG(X+i*Y)

Because there is a bug in ARG ?
see https://www.hpmuseum.org/forum/thread-16977.html

The bug must have been fixed again. I get the proper 45 with all the examples in that thread.

Tom L
Cui bono?
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
multi criteria IF statement - Amer7 - 06-11-2021, 11:06 AM
RE: multi criteria IF statement - Amer7 - 06-11-2021, 11:59 AM
RE: multi criteria IF statement - Dougggg - 06-12-2021, 03:05 AM
RE: multi criteria IF statement - toml_12953 - 06-13-2021 05:35 AM
RE: multi criteria IF statement - Joe Horn - 06-13-2021, 01:10 PM



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