VOOZH about

URL: https://www.geeksforgeeks.org/dsa/how-to-find-arctangent-with-examples/

⇱ How to find arctangent with Examples - GeeksforGeeks


  • Courses
  • Tutorials
  • Interview Prep

How to find arctangent with Examples

Last Updated : 15 Jul, 2025

The arctangent is the inverse of the tangent function. It returns the angle whose tangent is the given number.

👁 Image

catan() is an inbuilt function in <complex.h> header file which returns the complex inverse tangent (or arc tangent) of any constant, which divides the imaginary axis on the basis of the inverse tangent in the closed interval [-i, +i] (where i stands for iota), used for evaluation of a complex object say z is on imaginary axis whereas to determine a complex object which is real or integer, then internally invokes pre-defined methods as:

S.No.

Method 

Return Type

1.

atan() function takes a complex z of datatype double which determine arc tangent for real complex numbersReturns complex arc tangent lies in a range along real axis [-PI/2, +PI/2] for an argument of type double.

2.

atanf() function takes a complex z of datatype float double which determine arc tangent for real complex numbers.Returns complex arc tangent lies in a range along real axis [-PI/2, +PI/2] for an argument of type float.

3.

atanl() function takes a complex z of datatype long double which determine arc tangent for real complex numbersReturns complex arc tangent lies in a range along real axis [-PI/2, +PI/2] for an argument of type long double.

4.

catan() function takes a complex z of datatype double which also allows imaginary part of complex numbersReturns complex arc tangent lies in a range along imaginary axis [-i, +i] for a complex object of type double

5.

catanf()  function takes a complex z of datatype float double which also allows imaginary part of complex numbersReturns complex arc tangent lies in a range along imaginary axis [-i, +i] for a complex object of type float

6.

catanl()  function takes a complex z of datatype long double which also allows imaginary part of complex numbersReturns complex arc tangent lies in a range along imaginary axis [-i, +i] for a complex object of type long double

Syntax:

atan(double arg);
atanf(float arg);
atanl(long double arg);
where arg is a floating-point value
catan(double complex z);
catanf(float complex z);
catanl( long double complex z);
where z is a Type – generic macro


Parameter: These functions accept one mandatory parameter z which specifies the inverse tangent. The parameter can be of double, float, or long double datatype.

Return Value: This function returns complex arc tangent/arc tangent according to the type of the argument passed.

Below are the programs illustrate the above method:

: This program will illustrate the functions atan(), atanf(), and atanl() computes the principal value of the arc tangent of floating – point argument. If a range error occurs due to underflow, the correct result after rounding off is returned. 


Output
atan(1) = 0.785398, 4*atan(1)=3.141593
atan(-0.0) = -0.000000, atan(+0.0) = +0.000000
atan(Inf) = 1.570796, 2*atan(Inf) = 3.141593

atanf(1.1) = 0.832981, 4*atanf(1.5)=3.931175
atanf(-0.3) = -0.291457, atanf(+0.3) = +0.291457
atanf(Inf) = 1.570796, 2*atanf(Inf) = 3.141593

atanl(1.1) = 0.832981, 4*atanl(1.7)=4.156289
atanl(-1.3) = -0.915101, atanl(+0.3) = +0.291457
atanl(Inf) = 1.570796, 2*atanl(Inf) = 3.141593

: This program will illustrate the functions catan(), catanf(), and catanl() computes the principal value of the arc tangent of complex number as argument. 


Output
catan(+0 + 2i) = 1.570796 + 0.549306i
2*catan(+0 + i*Inf) = 3.141593+0.000000i

catanf(+0 + 2i) = 1.570796 + 0.549306i
2*catanf(+0 + i*Inf) = 3.141593 + 0.000000i

catan(+0+2i) = 1.570796+0.549306i
2*catanl(+0 + i*Inf) = 3.141593 + 0.000000i

: This program will illustrate the functions catanh(), catanhf(), and catanhl() computes the complex arc hyperbolic tangent of z along the real axis and in the interval [-i*PI/2, +i*PI/2] along the imaginary axis. 


Output
catanh(+2+0i) = 0.549306+1.570796i
catanh(1+2i) = 0.173287+1.178097i

catanhf(+2+0i) = 0.549306+1.570796i
catanhf(1+2i) = 0.173287+1.178097i

catanhl(+2+0i) = 0.549306+1.570796i
catanhl(1+2i) = 0.173287+1.178097i
Comment