User Tools

Site Tools


cpp:cmath:atan2

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

cpp:cmath:atan2 [2012/10/12 18:35] (current)
Line 1: Line 1:
 +{{keywords>wiki library source code example reference}}
 +====== atan2 ======
 +
 +<code cpp>
 +    double atan2(double , double );
 +</code>
 +calculates arctangent from 2 numbers
 +
 +===== cpp Sourcecode Example =====
 +
 +<code cpp>
 +#include <iostream> /* including standard library */
 +#include <cmath> /* including math library */
 +
 +using namespace std;
 +int main ( void ){
 +    double a=1.2, b=-2.6, res;
 +    res = atan2(a, b) * 90 / 3.17;
 +    
 +    //cout.setf(ios::fixed, ios::floatfield);
 +    cout.precision(7);
 +
 +    cout << "atan2 from " << a << " and " << b << " is "  << res << endl;
 +    return 0;
 +}
 +</code>
 +===== output =====
 +    atan2 from 1.2 and -2.6 is 76.91692
  
advertising
cpp/cmath/atan2.txt · Last modified: 2012/10/12 18:35 (external edit)

Impressum Datenschutz