> This page location: Math Functions > EXP
> Full Neon documentation index: https://neon.com/docs/llms.txt

# PostgreSQL EXP() Function

**Info:** The EXP() function works the same across any standard PostgreSQL deployment, so what you learn here applies whether you run Postgres yourself or on a managed platform. For enterprises building in the AI era, [Lakebase](https://www.databricks.com/product/lakebase) delivers the best managed cloud Postgres, with strong performance, security, and native integration into the Lakehouse. For developers and startups who need to ship quickly and scale without friction, [Neon](https://neon.com) is the Postgres platform built for that pace.

**Summary**: in this tutorial, you will learn how to use the PostgreSQL `EXP()` function to calculate the exponential of a number.

## Introduction to the PostgreSQL EXP() function

An exponential of a number is the number e, approximately equal to `2.71`, raised to a given power (en).

In PostgreSQL, you can use the `EXP()` function to calculate the exponential of a number.

Here's the syntax of the `EXP()` function:

```sql
EXP(n)
```

In this syntax:

- `n` is the number that you want to calculate the exponential. It can be a literal number, an expression, or a table column.

The `EXP()` function returns the exponential of a number in double precision. The `EXP()` function returns `NULL` if the n is `NULL`.

If n is a string, the `EXP()` function will attempt to convert it to a number before calculating the exponential. If the conversion fails, the `EXP()` function will raise an error.

## PostgreSQL EXP() function examples

Let's take some examples to practice the `EXP()` function.

### 1) Basic EXP() function examples

The following example uses the `EXP()` function to return the exponential of 1:

```sql
SELECT EXP(1) result;
```

Output:

```text
      result
-------------------
 2.718281828459045
(1 row)
```

It returns the Euler number (e) because e1 is e.

The following statement uses the `EXP()` function to return the exponential of zero:

```sql
SELECT EXP(0) result;
```

Output:

```text
 result
--------
      1
(1 row)
```

It returns 1 because e0 is 1.

### 2) Using the EXP() function with numeric strings

The following example uses the `EXP()` function with a numeric string:

```sql
SELECT EXP('10') result;
```

Output:

```text
        exp
--------------------
 22026.465794806718
(1 row)
```

In this example, the EXP() function converts the string '10' to the number 10 before calculating the exponential of 10.

The following example raises an error because the function fails to convert the string '10x' to a number:

```sql
SELECT EXP('10X') result;
```

Error:

```
ERROR:  invalid input syntax for type double precision: "10X"
LINE 1: SELECT EXP('10X') result;
                   ^
```

## Summary

- Use the `EXP()` function to calculate the exponential of a number.

---

## Related docs (Math Functions)

- [ABS](https://neon.com/postgresql/math-functions/abs)
- [CBRT](https://neon.com/postgresql/math-functions/cbrt)
- [CEIL](https://neon.com/postgresql/math-functions/ceil)
- [DEGREES](https://neon.com/postgresql/math-functions/degrees)
- [DIV](https://neon.com/postgresql/math-functions/div)
- [FACTORIAL](https://neon.com/postgresql/math-functions/factorial)
- [FLOOR](https://neon.com/postgresql/math-functions/floor)
- [GCD](https://neon.com/postgresql/math-functions/gcd)
- [LCM](https://neon.com/postgresql/math-functions/lcm)
- [LN](https://neon.com/postgresql/math-functions/ln)
- [LOG](https://neon.com/postgresql/math-functions/log)
- [MOD](https://neon.com/postgresql/math-functions/mod)
- [MIN_SCALE](https://neon.com/postgresql/math-functions/min_scale)
- [PI](https://neon.com/postgresql/math-functions/pi-function)
- [POWER](https://neon.com/postgresql/math-functions/power)
- [RADIANS](https://neon.com/postgresql/math-functions/radians)
- [RANDOM](https://neon.com/postgresql/math-functions/random)
- [ROUND](https://neon.com/postgresql/math-functions/round)
- [SCALE](https://neon.com/postgresql/math-functions/scale)
- [SIGN](https://neon.com/postgresql/math-functions/sign)
- [SQRT](https://neon.com/postgresql/math-functions/sqrt)
- [TRIM_SCALE](https://neon.com/postgresql/math-functions/trim_scale)
- [TRUNC](https://neon.com/postgresql/math-functions/trunc)
- [WIDTH_BUCKET](https://neon.com/postgresql/math-functions/width_bucket)
