title | description | author | ms.author | ms.date | ms.service | ms.subservice | ms.topic | f1_keywords | helpviewer_keywords | dev_langs | monikerRange | |||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
EXP (Transact-SQL) |
EXP (Transact-SQL) |
markingmyname |
maghan |
03/06/2017 |
sql |
t-sql |
reference |
|
|
|
>= aps-pdw-2016 || = azuresqldb-current || = azure-sqldw-latest || >= sql-server-2016 || >= sql-server-linux-2017 || = azuresqldb-mi-current||=fabric |
[!INCLUDE sql-asdb-asdbmi-asa-pdw-fabricse-fabricdw]
Returns the exponential value of the specified float expression.
:::image type="icon" source="../../includes/media/topic-link-icon.svg" border="false"::: Transact-SQL syntax conventions
EXP ( float_expression )
float_expression
Is an expression of type float or of a type that can be implicitly converted to float.
float
The constant e (2.718281...), is the base of natural logarithms.
The exponent of a number is the constant e raised to the power of the number. For example EXP(1.0) = e^1.0 = 2.71828182845905 and EXP(10) = e^10 = 22026.4657948067.
The exponential of the natural logarithm of a number is the number itself: EXP (LOG (n)) = n. And the natural logarithm of the exponential of a number is the number itself: LOG (EXP (n)) = n.
The following example declares a variable and returns the exponential value of the specified variable (10
) with a text description.
DECLARE @var FLOAT
SET @var = 10
SELECT 'The EXP of the variable is: ' + CONVERT(VARCHAR, EXP(@var))
GO
[!INCLUDEssResult]
----------------------------------------------------------
The EXP of the variable is: 22026.5
(1 row(s) affected)
The following example returns the exponential value of the natural logarithm of 20
and the natural logarithm of the exponential of 20
. Because these functions are inverse functions of one another, the return value in both cases is 20
.
SELECT EXP(LOG(20)), LOG(EXP(20))
GO
[!INCLUDEssResult]
---------------------- ----------------------
20 20
(1 row(s) affected)
Examples: [!INCLUDEssazuresynapse-md] and [!INCLUDEssPDW]
The following example returns the exponential value of the specified value (10
).
SELECT EXP(10);
[!INCLUDEssResult]
----------
22026.4657948067
The following example returns the exponential value of the natural logarithm of 20
and the natural logarithm of the exponential of 20
. Because these functions are inverse functions of one another, the return value in both cases is 20
.
SELECT EXP( LOG(20)), LOG( EXP(20));
[!INCLUDEssResult]
-------------- -----------------
20 20
Mathematical Functions (Transact-SQL)
LOG (Transact-SQL)
LOG10 (Transact-SQL)