Skip to content

Latest commit

 

History

History
135 lines (113 loc) · 4.43 KB

radians-transact-sql.md

File metadata and controls

135 lines (113 loc) · 4.43 KB
title description author ms.author ms.date ms.service ms.subservice ms.topic f1_keywords helpviewer_keywords dev_langs monikerRange
RADIANS (Transact-SQL)
RADIANS (Transact-SQL)
MikeRayMSFT
mikeray
03/13/2017
sql
t-sql
reference
RADIANS
RADIANS_TSQL
RADIANS function
TSQL
>= aps-pdw-2016 || = azuresqldb-current || = azure-sqldw-latest || >= sql-server-2016 || >= sql-server-linux-2017 || = azuresqldb-mi-current||=fabric

RADIANS (Transact-SQL)

[!INCLUDE sql-asdb-asdbmi-asa-pdw-fabricse-fabricdw]

Returns radians when a numeric expression, in degrees, is entered.

:::image type="icon" source="../../includes/media/topic-link-icon.svg" border="false"::: Transact-SQL syntax conventions

Syntax

RADIANS ( numeric_expression )  

[!INCLUDEsql-server-tsql-previous-offline-documentation]

Arguments

numeric_expression
Is an expression of the exact numeric or approximate numeric data type category.

Return Types

The return type depends on the input type of numeric_expression:

Input type Return type
float, real float
decimal(p, s) decimal(38, s)
int, smallint, tinyint int
bigint bigint
money, smallmoney money
bit float

If the result does not fit in the return type, an arithmetic overflow error occurs.

Examples

A. Using RADIANS to show 0.0

The following example returns a result of 0.0 because the numeric expression to convert to radians is too small for the RADIANS function.

SELECT RADIANS(1e-307)  
GO  

[!INCLUDEssResult]

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

B. Using RADIANS to return the equivalent angle of a float expression.

The following example takes a float expression and returns the RADIANS of the specified angle.

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

[!INCLUDEssResult]

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

See Also

CAST and CONVERT (Transact-SQL)
decimal and numeric (Transact-SQL)
float and real (Transact-SQL)
int, bigint, smallint, and tinyint (Transact-SQL)
Mathematical Functions (Transact-SQL)
money and smallmoney (Transact-SQL)