atan2f() in C++

atan2f(): This function is available in the file math.h. It computes the arc tangent of x/y using the signs of arguments to determine the correct quadrant. It takes two arguments. It returns the value in the range [-π,π] radians.

Parameters: Two parameters are required for this function. Floating-point value.

x - this value represents the proportion of the x-coordinate.

y - this value represents the proportion of the y-coordinate.

Syntax:

atan2f(x,y)

For Example:

atan2f(1,2) = > It returns the value 0.463648

Approach

C++

#include <bits/stdc++.h>
using namespace std;

int main()
{
    float x = 1y = 2;
    cout << atan2f(xy<< "\n";

    return 0;
}


No comments:

Post a Comment