RADIANS (Transact-SQL)

Retorna radianos quando uma expressão numérica, em graus, é inserida.

Ícone de vínculo de tópicoConvenções de sintaxe Transact-SQL

Sintaxe

RADIANS ( numeric_expression )

Argumentos

  • numeric_expression
    É uma expressão da categoria de tipo de dados numéricos exatos ou aproximados, com exceção do tipo de dados bit.

Tipos de retorno

Retorna o mesmo tipo que numeric_expression.

Exemplos

A. Usando RADIANS para mostrar 0.0

O exemplo a seguir retorna um resultado de 0.0 porque a expressão numérica a ser convertida em radianos é muito pequena para a função RADIANS.

SELECT RADIANS(1e-307)
GO

Conjunto de resultados.

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

B. Usando RADIANS para retornar o ângulo equivalente de uma expressão flutuante.

O exemplo a seguir usa uma expressão float e retorna os 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

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)