How to use atan() function to compute the principal value of the arc tangent of N in C++

1 Answer

0 votes
#include <iostream>
#include <cmath>

using namespace std;

int main()
{
	cout << "atan(1.0) = " << atan(1.0) << endl;
	cout << "atan(-1.0) = " << atan(-1.0) << endl;
	cout << "atan(0.0) = " << atan(0.0) << endl;
	cout << "atan(-0.0) = " << atan(-0.0) << endl;
	cout << "atan(INFINITY) = " << atan(INFINITY) << endl;

	return 0;
}

/*
run:

atan(1.0) = 0.785398
atan(-1.0) = -0.785398
atan(0.0) = 0
atan(-0.0) = -0
atan(INFINITY) = 1.5708

*/

 



answered Apr 1, 2016 by avibootz
...