Summary: in this tutorial, you will learn how to use the SQLite exp() function to calculate the e (Euler’s number) raised to the power of a number.
Introduction to SQLite exp() function #
The exp() function allows you to compute e raise to the power of a specified number.
The following shows the syntax for the exp() function:
exp(x)
In this syntax:
- The
xis a number that you want to compute e raised to its power.
The exp() function returns ex where e is approximately equal to 2.71828182845905. The function returns NULL if x is NULL.
SQLite exp() function examples #
Let’s explore some examples of using the exp() function.
1) Basic exp() function examples #
The following statement uses the exp() function to compute the exponential value of 1:
SELECT exp(1) result;
Output:
result
-----------------
2.718281828459045
The following example uses the exp() function to calculate the exponential value of 2:
SELECT exp(2) result;
Output:
result
----------------
7.38905609893065
2) Using exp() function with negative power #
The following example uses the exp() function with a negative power:
SELECT exp(-1) result;
Output:
result
-------------------
0.36787944117144233
Summary #
- Use the
exp()function to compute e raised to the power of a number.
Thank you for your feedback!