blob: 62ae7e8a6910f64d7c24505f4b5ea04d2db24878 [file]
<html lang="en">
<head>
<title>atan2 - Untitled</title>
<meta http-equiv="Content-Type" content="text/html">
<meta name="description" content="Untitled">
<meta name="generator" content="makeinfo 4.13">
<link title="Top" rel="start" href="index.html#Top">
<link rel="up" href="Math.html#Math" title="Math">
<link rel="prev" href="atan.html#atan" title="atan">
<link rel="next" href="atanh.html#atanh" title="atanh">
<link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage">
<meta http-equiv="Content-Style-Type" content="text/css">
<style type="text/css"><!--
pre.display { font-family:inherit }
pre.format { font-family:inherit }
pre.smalldisplay { font-family:inherit; font-size:smaller }
pre.smallformat { font-family:inherit; font-size:smaller }
pre.smallexample { font-size:smaller }
pre.smalllisp { font-size:smaller }
span.sc { font-variant:small-caps }
span.roman { font-family:serif; font-weight:normal; }
span.sansserif { font-family:sans-serif; font-weight:normal; }
--></style>
</head>
<body>
<div class="node">
<a name="atan2"></a>
<p>
Next:&nbsp;<a rel="next" accesskey="n" href="atanh.html#atanh">atanh</a>,
Previous:&nbsp;<a rel="previous" accesskey="p" href="atan.html#atan">atan</a>,
Up:&nbsp;<a rel="up" accesskey="u" href="Math.html#Math">Math</a>
<hr>
</div>
<h3 class="section">1.8 <code>atan2</code>, <code>atan2f</code>&mdash;arc tangent of y/x</h3>
<p><a name="index-atan2-15"></a><a name="index-atan2f-16"></a><strong>Synopsis</strong>
<pre class="example"> #include &lt;math.h&gt;
double atan2(double <var>y</var>,double <var>x</var>);
float atan2f(float <var>y</var>,float <var>x</var>);
</pre>
<p><strong>Description</strong><br>
<p><code>atan2</code> computes the inverse tangent (arc tangent) of <var>y</var>/<var>x</var>.
<code>atan2</code> produces the correct result even for angles near
pi/2 or -pi/2
(that is, when <var>x</var> is near 0).
<p><code>atan2f</code> is identical to <code>atan2</code>, save that it takes and returns
<code>float</code>.
<p><br>
<strong>Returns</strong><br>
<code>atan2</code> and <code>atan2f</code> return a value in radians, in the range of
-pi to pi.
<p>You can modify error handling for these functions using <code>matherr</code>.
<p><br>
<strong>Portability</strong><br>
<code>atan2</code> is ANSI C. <code>atan2f</code> is an extension.
<p><br>
</body></html>