MySQL - RADIANS() Function



MySQL provides a set of functions to perform various numerical functions. The RADIANS() function of MySQL converts an angle in degrees to radians.

Angles are measured in degrees and radians. One full revolution of a side equals 360 degrees, whereas the angle subtended by an arc with length 1 unit at the centre of the circle with radius 1 unit has a measure of 1 radian.

This function accepts a value representing the angle in degrees as an argument, converts it in to radians and returns the result.

Syntax

Following is the syntax of MySQL RADIANS() function −

RADIANS(X);

Parameters

This function takes an angle in degrees as a parameter.

Return Value

This function returns the given angle converted to radians.

Example

In the following query, we are using the MySQL RADIANS() function to convert the angle 180 degrees into radians −

SELECT RADIANS(180) As Result;

Output

This will produce the following result −

Result
3.141592653589793

Example

Following is another example of this function, where we are converting the angle 360 degrees into radians −

SELECT RADIANS(360) As Result;

Output

Following is the output −

Result
6.283185307179586

Example

We can also pass the degrees to this function as a string −

SELECT RADIANS('90') As Result;

Output

Following is the output −

Result
1.5707963267948966

Example

The following query converts the value of Π (pi) from degrees to radians −

SELECT RADIANS(PI()) As Result;

Output

The output will be displayed as followed −

Result
0.05483113556160755
Advertisements