atan2

function

Library: Trigonometry (OMTRIG)
Import : omtrig.xmd

Returns: Rectangular co-ordinates.


Declaration
export external float function
     atan2 (value float x, value float y)


Purpose

Use atan2 with two rectangular co-ordinates, x and y, as arguments to calculate the arc tangent (y/x). atan2 gives you the degree in radians. This trigonometric function works in conjunction with hypot.

In mathematics, the arc tangent is also called the inverse tangent.

Out-of-range values, such as acos() and asin() for |x| > 1, return "not a number" (NaN).

Example:


  import "omtrig.xmd" unprefixed
  import "omfloat.xmd" unprefixed
  process
     local float x initial {1.1}
     local float y initial {0.7}
     local float atan2-value
     set atan2-value to atan2 (x, y)
     output "Take the rectangular co-ordinates x ( = "
         || "d" % x
         || " ) and y ( = "
         || "d" % y
         || " ) %n"
         || "Their arc tangent = "
         || "d" % atan2-value
         || "%n"
  ; Output: "Take the rectangular co-ordinates x ( = 1.1 ) and y ( = 0.7 )"
  ;          "Their arc tangent = 1.00406710927139"

Other Library Functions