ATANPI(3) - [MATHEMATICS:TRIGONOMETRIC] Circular Arctangent AKA inverse tangent function
result = atanpi([x) | atanpi(y, x)
elemental real(kind=KIND) function atanpi(y,x)real(kind=KIND),intent(in) :: x real(kind=KIND),intent(in),optional :: y
o Y and X must both be real and of the same KIND o KIND can be any kind supported by the real type. o The returned value is of the same type and kind as X.
ATAN(3) computes the circular arctangent of X in half-revolutions.
If Y appears, the result is the same as the result of ATAN2PI(Y,X). If Y does not appear, the result has a value equal to a processor-dependent approximation to the arc tangent of X; it is expressed in half-revolutions and lies in the range -0.5 <= ATANPI(X) <= 0.5.
Example. ATANPI(1.0) has the value 0.25 (approximately).
o X : The real value to compute the arctangent of. 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 ATAN2PI(Y,X). Otherwise, it is the arc tangent of X, where the result is in half-revolutions and lies in the range -1 <= ATAN(X) <= 1
Sample program:
program demo_atanpi use, intrinsic :: iso_fortran_env, only : real32, real64 implicit none character(len=*),parameter :: all=(*(g0,1x)) real(kind=real64) :: x, y x=2.866_real64 print all, atanpi(x)Results:print all, atanpi( 2.0d0, 2.0d0),atanpi( 2.0d0, 2.0d0)*180 print all, atanpi( 2.0d0,-2.0d0),atanpi( 2.0d0,-2.0d0)*180 print all, atanpi(-2.0d0, 2.0d0),atanpi(-2.0d0, 2.0d0)*180 print all, atanpi(-2.0d0,-2.0d0),atanpi(-2.0d0,-2.0d0)*180
end program demo_atanpi
> 0.39313990502447488 > 0.25000000000000000 45.000000000000000 > 0.75000000000000000 135.00000000000000 > -0.25000000000000000 -45.000000000000000 > -0.75000000000000000 -135.00000000000000
Fortran 2023
ATAN2D(3), TAN2D(3), ATAN2PI(3), TAN2PI(3)
o wikipedia: inverse trigonometric functions
Nemo Release 3.1 | atanpi (3fortran) | November 02, 2024 |