RADIANS (Transact-SQL)
Devuelve los radianes de una expresión numérica en grados.
Convenciones de sintaxis de Transact-SQL
Sintaxis
RADIANS ( numeric_expression )
Argumentos
numeric_expression
Es una expresión de la categoría de tipo de datos numérico exacto o numérico aproximado, excepto para el tipo de datos bit.
Tipos de valor devueltos
Devuelve el mismo tipo que numeric_expression.
Ejemplos
A. Utilizar RADIANS para mostrar 0.0
En este ejemplo se devuelve el resultado 0.0
debido a que la expresión numérica que se va a convertir en radianes es demasiado pequeña para la función RADIANS
.
SELECT RADIANS(1e-307)
GO
Éste es el conjunto de resultados.
-------------------
0.0
(1 row(s) affected)
B. Utilizar RADIANS para devolver el ángulo equivalente de una expresión float
En este ejemplo se toma una expresión float
y se devuelve el valor RADIANS
del á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
Éste es el 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)
Vea también
Referencia
CAST y CONVERT (Transact-SQL)
decimal y numeric (Transact-SQL)
float y real (Transact-SQL)
int, bigint, smallint y tinyint (Transact-SQL)
Funciones matemáticas (Transact-SQL)
money y smallmoney (Transact-SQL)