The RADIANS() function converts a degree value into radians.
Syntax
RADIANS(number)
Definition and Usage
- The
RADIANS()function is used to convert an angle from degrees to radians. - This is commonly used in trigonometric calculations.
Parameter Values
| Parameter | Description |
|---|---|
number |
Required. A number in degrees |
Technical Details
- Introduced in: MySQL 4.0
- Return Value: A floating-point number representing the angle in radians.
Examples
Example 1: Convert 180 degrees to radians
SELECT RADIANS(180) AS RadiansValue;
Output:
RadiansValue
------------
3.141593
Explanation: 180∘180^\circ is equal to π\pi radians.
Example 2: Convert 90 degrees to radians
SELECT RADIANS(90) AS RadiansValue;
Output:
RadiansValue
------------
1.570796
Explanation: 90∘90^\circ is equal to π2\frac{\pi}{2} radians.
Example 3: Use with a table
If you have a table Angles with a column Degrees, you can convert each degree value to radians:
SELECT Degrees, RADIANS(Degrees) AS RadiansValue
FROM Angles;
Example 4: Calculate the sine of an angle in degrees
To calculate the sine of 45 degrees:
SELECT SIN(RADIANS(45)) AS SineValue;
Output:
SineValue
---------
0.707107
Related Functions
DEGREES(): Converts radians into degrees.PI(): Returns the value of π\pi.- Trigonometric Functions:
SIN(),COS(),TAN()for operations in radians.
The RADIANS() function is a critical tool for converting angles to radians, enabling seamless trigonometric computations in MySQL.