PostgreSQL degrees() Function

The PostgreSQL degrees() function converts the specified radian value to a degree value and returns the result.

If you need to convert degrees to radians, use the radians() function.

degrees() Syntax

This is the syntax of the PostgreSQL degrees() function:

degrees(radians) -> double precision

Parameters

radians

Required. A radian value.

Return value

The PostgreSQL degrees() function converts the specified radian value to a degree value and returns the result.

The degrees() function will NULL return if the argument is NULL.

PostgreSQL will give an error if you supply a parameter that is not a numeric type.

degrees() Examples

Here are a few examples of the degrees() function:

SELECT
    degrees(0) AS "degrees(0)",
    degrees(pi()) AS "degrees(pi())",
    degrees(3*pi()) AS "degrees(3*pi())",
    degrees(-3*pi()) AS "degrees(-3*pi())";
 degrees(0) | degrees(pi()) | degrees(3*pi()) | degrees(-3*pi())
------------+---------------+-----------------+------------------
          0 |           180 |             540 |             -540

Here we used the pi() function to get the value of π.