degrees function in APL to convert an angle from radians to degrees. The conversion formula is degrees = (180 / π) × angle_in_radians.
degrees is useful whenever you compute angles using trigonometric or inverse trigonometric functions, which return values in radians, but need the result expressed in degrees for display or comparison. For example, you can convert the output of atan2 or acos into a degree value that’s easier to interpret.
For users of other query languages
If you come from other query languages, this section explains how to adjust your existing queries to achieve the same results in APL.Splunk SPL users
Splunk SPL users
Splunk SPL doesn’t include a built-in
degrees() function. You compute the conversion manually by multiplying the radian value by 180 / pi().ANSI SQL users
ANSI SQL users
In SQL Server and PostgreSQL,
DEGREES() is a built-in function with identical semantics to the APL version.Usage
Syntax
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
a | real | Yes | The angle in radians to convert. |
Returns
The angle in degrees corresponding to the input radian value.Example
Usedegrees to convert an angle in radians to degrees.
Query
| result |
|---|
| 180 |
List of related functions
- radians: Converts degrees to radians. Use it for the inverse conversion before passing values to trigonometric functions.
- pi: Returns the constant π. Use it in manual radian-to-degree conversions as an alternative to
degrees. - cos: Returns the cosine of an angle in radians. Use
degreesto convert its output for display. - sin: Returns the sine of an angle in radians. Use
degreesto convert angular results. - atan2: Returns an angle in radians from two coordinates. Use
degreesto convert its output to degrees.