User Tools

Site Tools


Sidebar

Programming Reference/Librarys

Question & Answer

Q&A is closed







cpp:cmath:atan2

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
advertising
cpp/cmath/atan2.txt · Last modified: 2012/10/12 18:35 (external edit)

Impressum Datenschutz