35 of 323
ZBasic System Library 25 ZX Microcontroller Family Atn2 Type Function returning Single Invocation Atn2(y, x) Parameter Method Type Description y ByVal Single y coordinate. x ByVal Single x coordinate. Discussion This function computes the principal value of the arc tangent of y/x, using the signs of both arguments to determine the quadrant of the return value. The return value will be the angle, expressed in radians, from the positive x-axis to the line connecting the origin and the given point. The type of the return value will be Single and the value will range from -p to p. If x is zero, the result is undefined unless y is also zero in which case 0.0 will be returned. Example Dim x as Single, y as Single, theta as Single x = 1.0 y = -1.0 theta = Atn2(y, x) ' result is –0.7854 Compatibility This function is not available in BasicX compatibility mode. See Also Atn, DegToRad, RadToDeg