Skip to main content

RADIANS (SQL)

A numeric function that converts degrees to radians.

Synopsis

RADIANS(numeric-expression)

{fn RADIANS(numeric-expression)}

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.

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.

RADIANS can be specified as either a standard scalar function or an ODBC scalar function with curly brace syntax.

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

FeedbackOpens in a new tab