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)