Start Back Next End
  
ZBasic System Library
49
ZBasic Microcontrollers
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 both x and y are zero, the value 0.0 will be returned as
a special case.
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
Previous page Top Next page