Namespaces
Variants
Views
Actions

Difference between revisions of "cpp/numeric/math/atan2"

From cppreference.com
< cpp‎ | numeric‎ | math
(+integral overloads (a bit more complicated for two-argument functions))
m (better explanation for integers)
Line 3: Line 3:
 
{{ddcl list begin}}
 
{{ddcl list begin}}
 
{{ddcl list header | cmath}}
 
{{ddcl list header | cmath}}
{{ddcl list item |
+
{{ddcl list item | num = 4 |
 
float      atan2( float y, float x );
 
float      atan2( float y, float x );
 
}}
 
}}
{{ddcl list item |
+
{{ddcl list item | num = 4 |
 
double      atan2( double y, double x );
 
double      atan2( double y, double x );
 
}}
 
}}
{{ddcl list item |
+
{{ddcl list item | num = 4 |
 
long double atan2( long double y, long double x );
 
long double atan2( long double y, long double x );
 
}}
 
}}
{{ddcl list item | notes={{mark since c++11}} |
+
{{ddcl list item | notes={{mark since c++11}} | num = 4 |
double      atan2( Integral y, Arithmetic x );
+
Promoted    atan2( Arithmetic y, Arithmetic x );
}}
+
{{ddcl list item | notes={{mark since c++11}} |
+
double      atan2( Arithmetic y, Integral x );
+
 
}}
 
}}
 
{{ddcl list end}}
 
{{ddcl list end}}
  
 
Computes the inverse tangent of {{tt|y/x}} using the signs of arguments to correctly determine quadrant.  
 
Computes the inverse tangent of {{tt|y/x}} using the signs of arguments to correctly determine quadrant.  
 +
 +
4) If any argument has integral type, it is cast to {{cpp|double}}. If any other argument is {{cpp|long double}}, then the return type is {{cpp|long double}}, otherwise it is {{cpp|double}}.
  
 
===Parameters===
 
===Parameters===

Revision as of 15:16, 17 January 2012

Template:cpp/numeric/math/sidebar Template:ddcl list begin <tr class="t-dsc-header">

<td>
Defined in header <cmath>
</td>

<td></td> <td></td> </tr> <tr class="t-dcl ">

<td >
float       atan2( float y, float x );
</td>

<td > (4) </td> <td class="t-dcl-nopad"> </td> </tr> <tr class="t-dcl ">

<td >
double      atan2( double y, double x );
</td>

<td > (4) </td> <td class="t-dcl-nopad"> </td> </tr> <tr class="t-dcl ">

<td >
long double atan2( long double y, long double x );
</td>

<td > (4) </td> <td class="t-dcl-nopad"> </td> </tr> <tr class="t-dcl ">

<td >
Promoted    atan2( Arithmetic y, Arithmetic x );
</td>

<td > (4) </td> <td > (since C++11) </td> </tr> Template:ddcl list end

Computes the inverse tangent of y/x using the signs of arguments to correctly determine quadrant.

4) If any argument has integral type, it is cast to Template:cpp. If any other argument is Template:cpp, then the return type is Template:cpp, otherwise it is Template:cpp.

Contents

Parameters

x, y - floating point value

Return value

arc tangent of y/x in radians in the range of [-π; π] radians.

Example

Template:example cpp


See also

Template:cpp/numeric/math/dcl list atanTemplate:cpp/numeric/math/dcl list asinTemplate:cpp/numeric/math/dcl list acosTemplate:cpp/numeric/math/dcl list tan