docs.intersystems.com
Home / InterSystems SQL Reference / SQL Functions / ATAN2

InterSystems SQL Reference
ATAN2
Previous section           Next section
InterSystems: The power behind what matters   
Search:  


A scalar numeric function that takes two coordinates and returns the arc-tangent angle in radians.
Synopsis
{fn ATAN2(y,x)}
Arguments
y A numeric expression specifying the y axis coordinate.
x A numeric expression specifying the x axis coordinate.
ATAN2 returns either the NUMERIC or DOUBLE data type. If numeric-expression is data type DOUBLE, ATAN2 returns DOUBLE; otherwise, it returns NUMERIC.
Description
ATAN2 takes the Cartesian coordinates of a ray (y,x) and returns the inverse (arc) of the tangent of an angle as a floating point number. The signs of both coordinates are used to determine the Cartesian coordinate. When x is a positive value, ATAN2 returns the same value as ATAN(y/x). ATAN2 returns NULL if passed a NULL value. ATAN2 treats nonnumeric strings, including the empty string (''), as the numeric value 0.
ATAN2 returns a value with a precision of 36 and a scale of 18.
ATAN2 can only be used as an ODBC scalar function (with the curly brace syntax).
You can use the DEGREES function to convert radians to degrees. You can use the RADIANS function to convert degrees to radians.
Example
The following example invokes ATAN2:
SELECT {fn ATAN2(15,30)} AS ArcTangent 
returns 0.46
See Also


Previous section           Next section
View this book as PDF   |  Download all PDFs
Copyright © 1997-2019 InterSystems Corporation, Cambridge, MA
Content Date/Time: 2019-04-23 13:43:23