Math.atan2(y, x)

Hi,

Another strange thing today.... Math.atan2() function is not documented so I thought it simply does not exist in Math module. To my surprise, it worked well in simulator, exactly as you would expect. Then I run it on real device (Fenix 3) and I got an exception (this symbol/function does not exist). So I had to implement it myself:

function atan2(y, x) {
return
x > 0 ? Math.atan(y / x) :
x < 0 && y >= 0 ? Math.atan(y / x) + Math.PI :
x < 0 && y < 0 ? Math.atan(y / x) - Math.PI :
x == 0 && y > 0 ? Math.PI / 2 :
x == 0 && y < 0 ? -1 * Math.PI / 2 :
0;
}


Not sure if it is correct, but I followed Wikipedia :-). I have problems understanding even how percentages work, so do not ask me about math.
But I am quite nervous about many differences between simulator and real device. Can someone explain to me how simulation does work?

BTW, I have tried contacting my local Garmin distributor about possibility of providing some devices for testing apps. They told me they are not prepared for such things. Do you guys have some contact in Garmin where I can try it with better success? It does not seem very clever to me to buy all the devices just for testing (free) apps...

Best Regards,
David