SQLite EXP() Function
The SQLite EXP() function returns e raised to the power of specified number, i.e., ex. Please note that e is the base of the natural system of logarithms, and its value is approximately 2.71828182845905.
Syntax
EXP(x)
Parameters
x |
Required. Specify the exponent of e. |
Return Value
Returns e raised to the power of specified number.
Example 1:
The example below shows the usage of EXP() function.
SELECT EXP(0); Result: 1.0 SELECT EXP(1); Result: 2.71828182845905 SELECT EXP(-1); Result: 0.367879441171442 SELECT EXP(2); Result: 7.38905609893065 SELECT EXP(-2); Result: 0.135335283236613 SELECT LN(EXP(1)); Result: 1.0
Example 2:
Consider a database table called Sample with the following records:
Data | x |
---|---|
Data 1 | -2 |
Data 2 | -1 |
Data 3 | 0 |
Data 4 | 1 |
Data 5 | 2 |
The statement given below can be used to calculate the exponent of records of column x.
SELECT *, EXP(x) AS EXP_Value FROM Sample;
This will produce the result as shown below:
Data | x | EXP_Value |
---|---|---|
Data 1 | -2 | 0.135335283236613 |
Data 2 | -1 | 0.367879441171442 |
Data 3 | 0 | 1.0 |
Data 4 | 1 | 2.71828182845905 |
Data 5 | 2 | 7.38905609893065 |
❮ SQLite Functions