MySQL RADIANS() Function

The RADIANS() function in MySQL converts an angle from degrees to radians. This is a fundamental mathematical function used in trigonometry and other calculations involving angles.



RADIANS(): Definition and Usage

Degrees and radians are two common units for measuring angles. Degrees divide a circle into 360 parts, while radians relate the angle to the radius of a circle. Many trigonometric functions in MySQL (like SIN(), COS(), TAN()) expect their input angles to be in radians. The RADIANS() function is essential for converting degree values to radians before using them in such trigonometric calculations.

Syntax

Syntax

RADIANS(number)
      

Parameter Values

Parameter Description
number The angle in degrees. This is a required numeric value.

Examples

Converting Degrees to Radians

This example converts 180 degrees to radians. Remember that 180 degrees is equal to π radians.

Syntax

SELECT RADIANS(180);
      
Output

3.141592653589793
      

Converting Negative Degrees to Radians

This example shows the conversion of -45 degrees to radians.

Syntax

SELECT RADIANS(-45);
      
Output

-0.785398163397448
      

**Note:** The output values are approximate due to the nature of floating-point numbers and may vary slightly depending on your MySQL version.