Help! I am new at this. I am trying to get the atan of a Y value and a Z value.

for example if my Y value is 0.59 and my Z value is 0.87, then we have:

degrees = arctan of (0.59/0.87)

degrees = arctan (0.6782)

degrees = 34.14

So, how do I insert this into my sketch?

I tried

xdeg = atan (yValue / zValue);

This returns a number that is NOT the accurate degree measurement. BTW, xdeg was declared as

a float variable. Also yValue and zValue were declared as float.

I am get data for xdeg, but not the accurate degree result, instead, when for example Y=.59 and Z=.87, I get xdeg as 0.61...that is clearly not 34.14 degrees.

So how do I use atan to get the arctan (in degrees) of any variable?

thanks and HELP!