docs.intersystems.com
Home  /  Application Development: Core Topics  /  InterSystems SQL Reference  /  SQL Functions  /  RADIANS


InterSystems SQL Reference
RADIANS
[Back]  [Next] 
InterSystems: The power behind what matters   
Search:  


A numeric function that converts degrees to radians.
Synopsis
RADIANS(numeric-expression)
Arguments
numeric-expression The measure of an angle in degrees. An expression that resolves to a numeric value.
RADIANS returns either the NUMERIC or DOUBLE data type. If numeric-expression is data type DOUBLE, RADIANS returns DOUBLE; otherwise, it returns NUMERIC.
Description
RADIANS takes an angle measurement in degrees and returns the corresponding angle measurement in radians. RADIANS returns NULL if passed a NULL value.
The returned value has a default precision of 36 and a default scale of 18.
You can use the DEGREES function to convert radians to degrees.
Example
The following Embedded SQL example returns the radians equivalents corresponding to the degree values from 0 through 365 in 30-degree increments:
   SET a=0
   WHILE a<366 {
   &sql(SELECT RADIANS(:a) INTO :b)
   IF SQLCODE'=0 {
     WRITE !,"Error code ",SQLCODE
     QUIT }
   ELSE {
     WRITE !,"degrees ",a," = radians ",b
     SET a=a+30 }
   }
See Also