Convert an angle from radians to degrees.
DEGREES(expr)
## Overview Returns the input angle converted from radians to degrees. DEGREES multiplies by 180/pi (approximately 57.29578). It is the preferred conversion when presenting radian-valued intermediate results to human readers or feeding them into downstream consumers that expect degrees. ## Behavior - Accepts any finite DOUBLE value. - Returns a DOUBLE equal to the input times 180/pi. - Returns NULL if the argument is NULL. - Is exactly the inverse of RADIANS: DEGREES(RADIANS(x)) equals x to within one ULP. - Preserves sign. ## Numeric precision - Involves one multiplication by the constant 180/pi, which introduces at most one ULP of rounding. - DEGREES(PI()) typically returns exactly 180 because the two rounding errors cancel, but this is an engine-specific coincidence. - Round-trips (RADIANS(DEGREES(x)) or DEGREES(RADIANS(x))) can differ from the input by one ULP. ## Compatibility - Conforms to the SQL standard scalar function DEGREES. - Matches typical mathematical library implementations.
| Name | Type | Description |
|---|---|---|
expr | Specifies the angle in radians. Accepts any finite DOUBLE value. The conversion is a pure multiplication by 180/pi. |
-- pi radians equals 180 degrees
SELECT DEGREES(PI());
-- Result: 180.0
-- pi/2 radians equals 90 degrees
SELECT DEGREES(PI() / 2);
-- Result: 90.0
-- 1 radian in degrees
SELECT DEGREES(1);
-- Result: 57.29577951308232
-- Round-trip with RADIANS
SELECT DEGREES(RADIANS(45));
-- Result: 45.0
-- NULL propagation
SELECT DEGREES(NULL);
-- Result: NULL
-- Column use: present an arctangent result in degrees
SELECT track_id, DEGREES(ATAN2(north_delta, east_delta)) AS bearing_deg
FROM logistics.routes.legs;