RADIANS (Transact-SQL)
Restituisce l'equivalente in radianti dell'espressione numerica specificata espressa in gradi.
Sintassi
RADIANS ( numeric_expression )
Argomenti
- numeric_expression
Espressione di un tipo di dati della categoria numerici esatti o numerici approssimati, con l'eccezione del tipo di dati bit.
Tipi restituiti
Restituisce lo stesso tipo dell'argomento numeric_expression.
Esempi
A. Utilizzo di RADIANS con risultato 0.0
Nell'esempio seguente viene restituito il risultato 0.0 in quanto il valore dell'espressione numerica da convertire in radianti è troppo piccolo per la funzione RADIANS.
SELECT RADIANS(1e-307)
GO
Set di risultati:
-------------------
0.0
(1 row(s) affected)
B. Utilizzo di RADIANS per restituire l'angolo equivalente di un'espressione float
Nell'esempio seguente viene immessa un'espressione float e viene restituito il valore convertito da RADIANS per l'angolo specificato.
-- 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
Set di risultati:
---------------------------------------
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)