HiFirst of all, I was wondering if branching with IFs is really necessary. Steeven Paul seems to try to compute some sort of angle of vector (v5,v6) and I wonder if a regular function can be constructed without IFs.Anyway,I would use this instead:
let theta1 = if(v5 gt 0 and v6 gt 0) then Q1 ELSE 0
let theta2 = if(v5 lt 0 and v6 gt 0) then Q2 ELSE 0
let theta3 = if(v5 lt 0 and v6 lt 0) then Q3 ELSE 0
let theta4 = if(v5 gt 0 and v6 lt 0) then Q4 ELSE 0
let theta = theta1 + theta2 + theta3 + theta4Another trick islet s5 = v5 / abs(v5)let s6 = v6 / abs(v6)Notice that s5 = if v5 > 0 then 1 else -1 . Forget about v5 == 0. Likewise for v6. Now,let q = 180*(1 - s5)*(s6 + 1)/2 + 180*(1 - s6)/2This is what you want. Really? See:yes? cancel mode verifyyes? let v5 = 3; let v6 = 5; say `q`0yes? let v5 = -3; let v6 = 5; say `q`360yes? let v5 = -3; let v6 = -5; say `q`180yes? let v5 = 3; let v6 = -5; say `q`180What to do when v5 = 0 or v6 = 0 is left for the reader's exercise.Okay, I'm not seriously proposing this. It's just for fun :-) Having said that, using the SIGN function to emulate switches is a common (sometimes necessary) trick in programming.Cheers,Ryo