Table of Contents

atan2

    double atan2(double , double );

calculates arctangent from 2 numbers

cpp Sourcecode Example

#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;
}

output

  atan2 from 1.2 and -2.6 is 76.91692