<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en" dir="ltr">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="stylesheet" href="../../style.css">
<title>
Gambas Documentation - Ang
</title>
</head>
<table class="none" width="100%" cellpadding="0" cellspacing="0" border="0">
<tr><td align="left">
<font size="-1">
<a href="../../help+en"><img class="flag" alt="Home" border="0" src="../../img/lang/en.png" align="center"></a>&nbsp;
<a href="../lang+en">Up</a>&nbsp;
<a href="and+en">Previous</a>&nbsp;
<a href="append+en">Next</a>&nbsp;
</td></tr></table>
<div class="notab">
<h1>
Ang
</h1>
<div class="black"><font size="-2"><b>Syntax</b></font></div>
<pre class="syntax"><u>Angle</u> <b>= Ang (</b> <u>X</u> AS Float <b>,</b> <u>Y</u> AS Float <b>)</b> AS Float</pre><p>

This function calculates the arc tangent of the two variables <u>X</u> and <u>Y</u>.  It is similar to calculating the arc tangent of <u>X</u> / <u>Y</u>,  except that  the signs of both arguments are used to determine the quadrant of the result.
<p>
The function returns the result in radians,  which  is  between -&pi; and &pi; (inclusive).
<p>
This is the same function as <a href="atan2+en">ATan2</a>.
<p>
To convert rectangular coordinates to polar coordinates, use <a href="mag+en">Mag</a> to get the distance and this function to get the angle.
<p>
<div class="gray"><font size="-2"><b>Example</b></font></div>
<pre class="example">PRINT Deg(Ang(-1, 1))
<hr>135</pre>
<p>
<hr><b>See also</b><br>
<a href="../cat/trigo+en">Trigonometric Functions</a>&nbsp;

</div>
</body>
</html>

