ATAN2

The ATAN2 function returns the arc tangent of x and y coordinates as an angle expressed in radians. The first and second arguments specify the x and y coordinates, respectively.

Read syntax diagramSkip visual syntax diagramATAN2 (expression-1,expression-2)
expression-1
An expression that returns a value of any built-in numeric data type (except for DECFLOAT), character-string, or graphic-string data type. A string argument is cast to double-precision floating point before evaluating the function. For more information on converting strings to double-precision floating point, see DOUBLE_PRECISION or DOUBLE. If one argument is 0, the other argument must not be 0.
expression-2
An expression that returns a value of any built-in numeric data type (except for DECFLOAT), character-string, or graphic-string data type. A string argument is cast to double-precision floating point before evaluating the function. For more information on converting strings to double-precision floating point, see DOUBLE_PRECISION or DOUBLE. If one argument is 0, the other argument must not be 0.

The data type of the result is double-precision floating point. If any argument can be null, the result can be null; if any argument is null, the result is the null value.

Example

  • Assume that host variables HATAN2A and HATAN2B are DOUBLE host variables with values of 1 and 2, respectively.
      SELECT ATAN2(:HATAN2A,:HATAN2B)
        FROM SYSIBM.SYSDUMMY1
    Returns a double precision floating-point number with an approximate value of 1.1071487.