ATAN(3) - [MATHEMATICS:TRIGONOMETRIC] Arctangent AKA inverse tangent function
result = atan([x) | atan(y, x)
elemental TYPE(kind=KIND) function atan(y,x)TYPE(kind=KIND),intent(in) :: x TYPE(kind=**),intent(in),optional :: y
o If Y is present X and Y must both be real. Otherwise, X may be complex. o KIND can be any kind supported by the associated type. o The returned value is of the same type and kind as X.
ATAN(3) computes the arctangent of X.
o X : The value to compute the arctangent of. if Y is present, X shall be real. o Y : is of the same type and kind as X. If X is zero, Y must not be zero.
The returned value is of the same type and kind as X. If Y is present, the result is identical to ATAN2(Y,X). Otherwise, it is the arc tangent of X, where the real part of the result is in radians and lies in the range -PI/2 <= ATAN(X) <= PI/2
Sample program:
program demo_atan use, intrinsic :: iso_fortran_env, only : real32, real64, real128 implicit none character(len=*),parameter :: all=(*(g0,1x)) real(kind=real64),parameter :: & Deg_Per_Rad = 57.2957795130823208767981548_real64 real(kind=real64) :: x x=2.866_real64 print all, atan(x)Results:print all, atan( 2.0d0, 2.0d0),atan( 2.0d0, 2.0d0)*Deg_Per_Rad print all, atan( 2.0d0,-2.0d0),atan( 2.0d0,-2.0d0)*Deg_Per_Rad print all, atan(-2.0d0, 2.0d0),atan(-2.0d0, 2.0d0)*Deg_Per_Rad print all, atan(-2.0d0,-2.0d0),atan(-2.0d0,-2.0d0)*Deg_Per_Rad
end program demo_atan
> 1.235085437457879 > .7853981633974483 45.00000000000000 > 2.356194490192345 135.0000000000000 > -.7853981633974483 -45.00000000000000 > -2.356194490192345 -135.0000000000000
FORTRAN 77 for a complex argument; and for two arguments Fortran 2008
ATAN2(3), TAN(3)
Fortran intrinsic descriptions (license: MIT) @urbanjost
o wikipedia: inverse trigonometric functions
Nemo Release 3.1 | atan (3fortran) | November 02, 2024 |