ATAN2 scalar function

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

Read syntax diagramSkip visual syntax diagramATAN2( numeric-expression-1, numeric-expression-2)

The schema is SYSIBM.

The first and second arguments specify the x and y coordinates, respectively.

Each argument must be an expression that returns the value of any built-in numeric data type that is not DECFLOAT. Both arguments must not be 0. Any argument that is not a double precision floating-point number is converted to one for processing by the function.

The result of the function is a double precision floating-point number.

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. The following statement returns a double precision floating-point number with an approximate value of 1.1071487:
   SELECT ATAN2(:HATAN2A,:HATAN2B)
     FROM SYSIBM.SYSDUMMY1;