// math reference

SQL RADIANS function

Converts an angle from degrees to radians: RADIANS(180) is PI() and RADIANS(90) is about 1.5708.

Category
Math
Returns
double; SQL Server returns the input's type
In this category
40 of 82

Syntax

RADIANS(angle_degrees)

Engine support

EngineSupportNotes
SQL Server Yes Returns the input's type: RADIANS(180) is 3, RADIANS(180.0) is 3.141592653589793116
PostgreSQL Yes radians(double precision) only
MySQL Yes Built in
SQLite Yes Built in on 3.35+
Oracle Not built in No RADIANS; use x * ACOS(-1) / 180

Examples

PostgreSQL

SELECT RADIANS(180) AS pi_value;  -- 3.141592653589793

SQL Server

SELECT RADIANS(180) AS int_in, RADIANS(180.0) AS dec_in;  -- 3, 3.141592653589793116

PostgreSQL

SELECT SIN(RADIANS(30)) AS half;  -- 0.49999999999999994

Oracle

SELECT 30 * ACOS(-1) / 180 AS radians FROM dual;

Good to know

  • It is x * PI() / 180. On Oracle, spell it out: angle * ACOS(-1) / 180.
  • SQL Server truncates integer input: RADIANS(180) is 3 and RADIANS(30) is 0, so SIN(RADIANS(30)) is 0 there. Write RADIANS(30.0) or RADIANS(CAST(x AS FLOAT)).
  • The most common trig bug is skipping it: SIN(30) computes 30 radians. RADIANS(30) then SIN gives the intended 0.5.

Questions about RADIANS

What is the formula behind RADIANS?

x * PI() / 180. On Oracle, which lacks the function, write angle * ACOS(-1) / 180.

Why do I need RADIANS at all?

Every SQL trig function takes radians. Passing degrees computes the wrong angle silently: SIN(30) is the sine of 30 radians, about -0.988, not 0.5.

Is RADIANS(180) exactly pi?

It is the closest double to pi, accurate to about 16 digits, which is why SIN(RADIANS(180)) returns 1.2e-16 instead of 0. On SQL Server, RADIANS(180) with an integer argument is just 3.

Browse every function in the SQL function reference, or see what the SQLly desktop app does for your database.

Cheat sheets for the engines that have it: SQL Server, PostgreSQL, MySQL, SQLite.

// fewer lookups

Functions your engine actually has

SQLly's completion lists the built-in functions of the engine you're connected to, whether that's SQL Server, PostgreSQL, MySQL, SQLite or Oracle. Hover a function for help, and signature hints show each argument as you type.