# How to use EXP() to get Raise to the power of values in MySQL8?

With MySQL, we can do complex calculations very easily with the help of inbuilt mathematical functions. EXP(X) returns the value of e (the base of natural logarithms) raised to the power of X.

EXP(X) is a mathematical function. It returns the value of e (the base of natural logarithms) raised to the power of X. Where X is the value passed as an argument.

The constant e value is approximately 2.718281, is the base of natural logarithms.

You provide the specified value as an argument when calling the function.

The number e is a mathematical constant that is the base of the natural logarithm: the unique number whose natural logarithm is equal to one. It is approximately equal to 2.71828.

The opposite of this function is LOG() (using a single argument only) or LN().

It will return NULL, if X is passed as NULL.

It returns error, if any String argument is passed as an input.

## MySQL EXP() : Syntax

EXP ( X );

### MySQL EXP() : Parameter

Name, Required /Optional, Description
X , Required, Double , It represents a valid number.

#### MySQL EXP() : Output

Return, Description
NULL, if the argument is NULL.
Double, It returns the value of e (the base of natural logarithms) raised to the power of input number.

#### EXP() Example 1 : Basic Examples

Now, Let’s see some of the basic examples of it and see what it returns.

```mysql> SELECT EXP(5);
+-------------------+
| EXP(5) |
+-------------------+
| 148.4131591025766 |
+-------------------+
1 row in set (0.00 sec)```

#### EXP() Example 2 : Negative values

Now, Let’s see an example with a negative value and see what it returns.

```mysql> SELECT EXP(-5);
+----------------------+
| EXP(-5) |
+----------------------+
| 0.006737946999085467 |
+----------------------+
1 row in set (0.07 sec)```

#### EXP() Example 3 : Passing Zero (0) as an input

See the output, we have got 1 as result, when Zero (0) is passed as input.

```mysql> SELECT EXP(0);
+--------+
| EXP(0) |
+--------+
| 1 |
+--------+
1 row in set (0.00 sec)
```

#### EXP() Example 4 : With Expressions

We are using the EXP() function with expressions. See the below example.

```mmysql> SELECT EXP(1+1);
+------------------+
| EXP(1+1) |
+------------------+
| 7.38905609893065 |
+------------------+
1 row in set (0.04 sec)

mysql> SELECT EXP(3*2);
+-------------------+
| EXP(3*2) |
+-------------------+
| 403.4287934927351 |
+-------------------+
1 row in set (0.00 sec)```

#### EXP() Example 5 : NULL arguments

If the argument is NULL, it will return NULL. See the below example :

```mysql> SELECT EXP(NULL);
+-----------+
| EXP(NULL) |
+-----------+
| NULL |
+-----------+
1 row in set (0.52 sec)
```

#### EXP() Example 6 : RETURN the value of e

Passing 1 as a user input return the value of e (that is, e to the power of 1). See the below example :

```mysql> SELECT EXP(1);
+-------------------+
| EXP(1) |
+-------------------+
| 2.718281828459045 |
+-------------------+
1 row in set (0.00 sec)```