RADIANS (Transact-SQL)
对于在数值表达式中输入的度数值返回弧度值。
语法
RADIANS ( numeric_expression )
返回类型
返回与 numeric_expression 相同的类型。
示例
A. 使用 RADIANS 显示 0.0
以下示例返回结果 0.0,因为用于转换为弧度的数值表达式对于 RADIANS 函数太小。
SELECT RADIANS(1e-307)
GO
下面是结果集。
-------------------
0.0
(1 row(s) affected)
B. 使用 RADIANS 返回浮点表达式的等价角度。
以下示例执行 float 表达式并返回指定角度的 RADIANS。
-- First value is -45.01.
DECLARE @angle float
SET @angle = -45.01
SELECT 'The RADIANS of the angle is: ' +
CONVERT(varchar, RADIANS(@angle))
GO
-- Next value is -181.01.
DECLARE @angle float
SET @angle = -181.01
SELECT 'The RADIANS of the angle is: ' +
CONVERT(varchar, RADIANS(@angle))
GO
-- Next value is 0.00.
DECLARE @angle float
SET @angle = 0.00
SELECT 'The RADIANS of the angle is: ' +
CONVERT(varchar, RADIANS(@angle))
GO
-- Next value is 0.1472738.
DECLARE @angle float
SET @angle = 0.1472738
SELECT 'The RADIANS of the angle is: ' +
CONVERT(varchar, RADIANS(@angle))
GO
-- Last value is 197.1099392.
DECLARE @angle float
SET @angle = 197.1099392
SELECT 'The RADIANS of the angle is: ' +
CONVERT(varchar, RADIANS(@angle))
GO
下面是结果集。
---------------------------------------
The RADIANS of the angle is: -0.785573
(1 row(s) affected)
---------------------------------------
The RADIANS of the angle is: -3.15922
(1 row(s) affected)
---------------------------------------
The RADIANS of the angle is: 0
(1 row(s) affected)
---------------------------------------
The RADIANS of the angle is: 0.00257041
(1 row(s) affected)
---------------------------------------
The RADIANS of the angle is: 3.44022
(1 row(s) affected)