Partilhar via


RADIANS (Transact-SQL)

Aplica-se a:SQL ServerBase de Dados SQL do AzureInstância Gerida do Azure SQLAzure Synapse AnalyticsSistema de Plataforma de Análise (PDW)Ponto de Extremidade de Análise SQL no Microsoft FabricArmazém no Microsoft FabricBase de Dados SQL no Microsoft Fabric

Devolve radianos quando uma expressão numérica, em graus, é introduzida.

Transact-SQL convenções de sintaxe

Sintaxe

RADIANS ( numeric_expression )  

Arguments

numeric_expression
É uma expressão do tipo de dado numérico exato ou numérico aproximado.

Tipos de devolução

O tipo de retorno depende do tipo de entrada do numeric_expression:

Tipo de entrada Tipo de retorno
flutuar, real float
decimal(p, s) decimal(38, s)
int, smallint, minyint int
bigint bigint
dinheiro, dinheiro pequeno dinheiro
bit float

Se o resultado não caber no tipo de retorno, ocorre um erro de transbordamento aritmético.

Examples

A. Usar RADIANS para mostrar 0,0

O exemplo seguinte devolve um resultado de 0.0 porque a expressão numérica a converter em radianos é demasiado pequena para a RADIANS função.

SELECT RADIANS(1e-307)  
GO  

Aqui está o conjunto de resultados.

-------------------   
0.0                        
(1 row(s) affected)  

B. Usar RADIANS para devolver o ângulo equivalente de uma expressão flutuante.

O exemplo seguinte toma uma float expressão e devolve o RADIANS do ângulo especificado.

-- 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  

Aqui está o conjunto de resultados.

---------------------------------------   
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)  

Ver também

CAST e CONVERT (Transact-SQL)
decimais e numéricos (Transact-SQL)
flutuador e real (Transact-SQL)
int, bigint, smallint e tinyint (Transact-SQL)
Funções Matemáticas (Transact-SQL)
dinheiro e dinheiro pequeno (Transact-SQL)