Clicky

Fortran Wiki
atan2 (Rev #5, changes)

Skip the Navigation Links | Home Page | All Pages | Recently Revised | Authors | Feeds | Export |

Showing changes from revision #4 to #5: (追記) Added (追記ここまで) | (削除) Removed (削除ここまで) | (削除) Chan (削除ここまで)(追記) ged (追記ここまで)

Description

atan2(y, x) computes the arctangent of the complex number X+iY(削除) -\\\\\\\\\\X (削除ここまで)(追記) -\\\\-\\\\\\\\X (追記ここまで) + i Y.

(追記)

This function can be used to transform from Cartesian into polar coordinates and allows to determine the angle in the correct quadrant. To convert from Cartesian Coordinates (x,y)(x,y) to polar coordinates (r,\\theta):

(追記ここまで)
(追記) (追記ここまで)(追記)
\\begin{aligned} r &= \\sqrt{x^2 + y^2} \\\\ \\theta &= \\tan^{-1}(y / x) \\end{aligned}
(追記ここまで)
(追記) (追記ここまで)

Standard

FORTRAN 77 and later

Class

Elemental function

Syntax

(削除)

result = atan2(y, x)

(削除ここまで)
(追記)
result = atan2(y, x)
(追記ここまで)

Arguments

  • y - The type shall be real.
  • x - The type and kind type parameter shall be the same as y. If y is zero, then x must be nonzero.

Return value

The return value has the same type and kind type parameter as y. It is the principal value of the complex number X+iY(削除) X (削除ここまで)(追記) (r,\\ (追記ここまで)(追記) \\X (追記ここまで) + i Y. If x is nonzero, then it lies in the range -\\pi \\leq \\atan (x) \\leq \\pi. The sign is positive if y is positive. If y is zero, then the return value is zero if x is(削除) positive (削除ここまで)(追記) strictly (追記ここまで)(削除) and (削除ここまで)(追記) positive, (追記ここまで)\\pi if x is(削除) negative. (削除ここまで)(追記) negative (追記ここまで)(削除) Finally, (削除ここまで)(追記) and (追記ここまで)(削除) if (削除ここまで)(追記) y (追記ここまで)(追記) is positive zero (or the processor does not handle signed zeros), and (追記ここまで)(追記) -\\pi (追記ここまで)(追記) if (追記ここまで)(追記) x (追記ここまで)(追記) is negative and (追記ここまで)(追記) y (追記ここまで)(追記) is negative zero. Finally, if (追記ここまで)x is zero, then the magnitude of the result is \\pi/2.

Example

program test_atan2
 real(4) :: x = 1.e0_4, y = 0.5e0_4
 x = atan2(y,x)
end program test_atan2

(削除) Note: In (削除ここまで)(追記) Note: (追記ここまで) (追記) In (追記ここまで) Return value,(削除) NNemec changed the first \\leq to \\lt. Joe Krahn reverted the edit, following F2008 specs. (削除ここまで)(追記) NNemec (追記ここまで)(追記) (追記ここまで)(追記) changed (追記ここまで)(追記) the (追記ここまで)(追記) first (追記ここまで)(削除)

category: intrinsics
(削除ここまで)(追記) \\leq (追記ここまで)(追記) to (追記ここまで)(追記) \\lt (追記ここまで)(追記) . (追記ここまで)(追記) Joe Krahn (追記ここまで)(追記) reverted the edit, following the (追記ここまで)(追記) Fortran 2008 (追記ここまで)(追記) specs. (追記ここまで)

(追記) (追記ここまで)(追記)

category: intrinsics

(追記ここまで)
Revision from April 3, 2016 22:40:29 by Jason Blevins
Forward in time (to current) | Back in time (4 more) | See current | Hide changes | History | Rollback | View: Source | Linked from: Intrinsic procedures, Fortran 2008, atan

AltStyle によって変換されたページ (->オリジナル) /