radians
radians is useful as a preprocessing step before calling trigonometric functions such as sin, cos, or tan, which all expect their input in radians. If you have angle data in degrees, pass it through radians before applying any trigonometric operation.
Usage#
Syntax#
radians(a)Parameters#
| Name | Type | Required | Description |
|---|---|---|---|
a |
real | Yes | The angle in degrees to convert. |
Returns#
The angle in radians corresponding to the input degree value.
Example#
Use radians to convert an angle in degrees to radians.
Query
print result = radians(180)Output
| result |
|---|
| 3.1416 |
List of related functions#
- degrees: Converts radians to degrees. Use it for the inverse conversion after trigonometric computations.
- pi: Returns the constant π. Use it when you want to compute radian conversions manually instead of using
radians. - sin: Returns the sine of an angle in radians. Use
radiansto prepare degree inputs before callingsin. - cos: Returns the cosine of an angle in radians. Use
radiansto prepare degree inputs before callingcos. - tan: Returns the tangent of an angle in radians. Use
radiansto prepare degree inputs before callingtan.
Other query languages#
Splunk SPL users
Splunk SPL doesn't include a built-in radians() function. You compute the conversion manually by multiplying the degree value by pi() / 180.
Splunk example
| eval angle_rad = angle_deg * (pi() / 180)APL equivalent
['sample-http-logs']
| extend angle_rad = radians(angle_deg)ANSI SQL users
In SQL Server and PostgreSQL, RADIANS() is a built-in function with identical semantics to the APL version.
SQL example
SELECT RADIANS(angle_deg) AS angle_rad FROM logsAPL equivalent
['sample-http-logs']
| extend angle_rad = radians(angle_deg)