> ## Documentation Index
> Fetch the complete documentation index at: https://docs.firebolt.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Mathematical functions

> Spark mathematical functions supported in SparkSQL and Databricks compatibility modes.

Preview

Spark [mathematical functions](https://spark.apache.org/docs/latest/sql-ref-functions-builtin.html#mathematical-functions) in [SparkSQL and Databricks compatibility modes](https://docs.firebolt.io/reference-sql/spark/overview.md). Both modes share these functions. Support is one of: Supported, With limitations, or Not supported. Supported means every example in the Spark reference returns what Spark returns; a note under With limitations quotes a call that differs.

| Function | Support | Notes |
| :- | :- | :- |
| [`ASINH`](https://spark.apache.org/docs/4.1.0/api/sql/#asinh) | Supported | |
| [`ATAN`](https://spark.apache.org/docs/4.1.0/api/sql/#atan) | Supported | |
| [`ATAN2`](https://spark.apache.org/docs/4.1.0/api/sql/#atan2) | Supported | |
| [`CBRT`](https://spark.apache.org/docs/4.1.0/api/sql/#cbrt) | Supported | |
| [`COS`](https://spark.apache.org/docs/4.1.0/api/sql/#cos) | Supported | |
| [`COSH`](https://spark.apache.org/docs/4.1.0/api/sql/#cosh) | Supported | |
| [`COT`](https://spark.apache.org/docs/4.1.0/api/sql/#cot) | Supported | |
| [`CSC`](https://spark.apache.org/docs/4.1.0/api/sql/#csc) | Supported | |
| [`DEGREES`](https://spark.apache.org/docs/4.1.0/api/sql/#degrees) | Supported | |
| [`E`](https://spark.apache.org/docs/4.1.0/api/sql/#e) | Supported | |
| [`EXP`](https://spark.apache.org/docs/4.1.0/api/sql/#exp) | Supported | |
| [`GREATEST`](https://spark.apache.org/docs/4.1.0/api/sql/#greatest) | Supported | |
| [`HEX`](https://spark.apache.org/docs/4.1.0/api/sql/#hex) | Supported | |
| [`LEAST`](https://spark.apache.org/docs/4.1.0/api/sql/#least) | Supported | |
| [`LN`](https://spark.apache.org/docs/4.1.0/api/sql/#ln) | Supported | |
| [`LOG`](https://spark.apache.org/docs/4.1.0/api/sql/#log) | Supported | |
| [`LOG10`](https://spark.apache.org/docs/4.1.0/api/sql/#log10) | Supported | |
| [`LOG2`](https://spark.apache.org/docs/4.1.0/api/sql/#log2) | Supported | |
| [`NEGATIVE`](https://spark.apache.org/docs/4.1.0/api/sql/#negative) | Supported | |
| [`PI`](https://spark.apache.org/docs/4.1.0/api/sql/#pi) | Supported | |
| [`PMOD`](https://spark.apache.org/docs/4.1.0/api/sql/#pmod) | Supported | |
| [`POSITIVE`](https://spark.apache.org/docs/4.1.0/api/sql/#positive) | Supported | |
| [`POW`](https://spark.apache.org/docs/4.1.0/api/sql/#pow) | Supported | |
| [`POWER`](https://spark.apache.org/docs/4.1.0/api/sql/#power) | Supported | |
| [`RADIANS`](https://spark.apache.org/docs/4.1.0/api/sql/#radians) | Supported | |
| [`SEC`](https://spark.apache.org/docs/4.1.0/api/sql/#sec) | Supported | |
| [`SIN`](https://spark.apache.org/docs/4.1.0/api/sql/#sin) | Supported | |
| [`SINH`](https://spark.apache.org/docs/4.1.0/api/sql/#sinh) | Supported | |
| [`SQRT`](https://spark.apache.org/docs/4.1.0/api/sql/#sqrt) | Supported | |
| [`TAN`](https://spark.apache.org/docs/4.1.0/api/sql/#tan) | Supported | |
| [`TANH`](https://spark.apache.org/docs/4.1.0/api/sql/#tanh) | Supported | |
| [`UNHEX`](https://spark.apache.org/docs/4.1.0/api/sql/#unhex) | Supported | |
| [`ABS`](https://spark.apache.org/docs/4.1.0/api/sql/#abs) | With limitations | `abs(INTERVAL -'1-1' YEAR TO MONTH)` is not supported. |
| [`ACOS`](https://spark.apache.org/docs/4.1.0/api/sql/#acos) | With limitations | `acos(2)` raises an error, where Spark returns `NaN`. |
| [`ACOSH`](https://spark.apache.org/docs/4.1.0/api/sql/#acosh) | With limitations | `acosh(0)` raises an error, where Spark returns `NaN`. |
| [`ASIN`](https://spark.apache.org/docs/4.1.0/api/sql/#asin) | With limitations | `asin(2)` raises an error, where Spark returns `NaN`. |
| [`ATANH`](https://spark.apache.org/docs/4.1.0/api/sql/#atanh) | With limitations | `atanh(2)` raises an error, where Spark returns `NaN`. |
| [`BIN`](https://spark.apache.org/docs/4.1.0/api/sql/#bin) | With limitations | A negative number renders as 32 bits, where Spark renders 64. A non-integer argument is not supported. |
| [`CEIL`](https://spark.apache.org/docs/4.1.0/api/sql/#ceil) | With limitations | Returns `DOUBLE`, where Spark returns `NUMERIC(1, 0)`. |
| [`CEILING`](https://spark.apache.org/docs/4.1.0/api/sql/#ceiling) | With limitations | Returns `DOUBLE`, where Spark returns `NUMERIC(1, 0)`. |
| [`DIV`](https://spark.apache.org/docs/4.1.0/api/sql/#div) | With limitations | `INTERVAL '1-1' YEAR TO MONTH div INTERVAL '-1' MONTH` is not supported. |
| [`FLOOR`](https://spark.apache.org/docs/4.1.0/api/sql/#floor) | With limitations | Returns `DOUBLE`, where Spark returns `NUMERIC(1, 0)`. |
| [`MOD`](https://spark.apache.org/docs/4.1.0/api/sql/#mod) | With limitations | Integer arguments only: `mod(5.5, 2)` and `2 % 1.8` raise an error. |
| [`RAND`](https://spark.apache.org/docs/4.1.0/api/sql/#rand) | With limitations | A seed, as in `rand(0)`, is not supported. |
| [`RANDOM`](https://spark.apache.org/docs/4.1.0/api/sql/#random) | With limitations | A seed, as in `random(0)`, is not supported. |
| [`ROUND`](https://spark.apache.org/docs/4.1.0/api/sql/#round) | With limitations | `round(2.5, 0)` returns `2`, where Spark returns `3`. |
| [`SIGN`](https://spark.apache.org/docs/4.1.0/api/sql/#sign) | With limitations | Returns `INTEGER`, where Spark returns `DOUBLE`. |
| [`SIGNUM`](https://spark.apache.org/docs/4.1.0/api/sql/#signum) | With limitations | Returns `INTEGER`, where Spark returns `DOUBLE`. |
| `BROUND`, `CONV`, `EXPM1`, `FACTORIAL`, `HYPOT`, `LOG1P`, `RANDN`, `RINT`, `TRY_ADD`, `TRY_DIVIDE`, `TRY_MOD`, `TRY_MULTIPLY`, `TRY_SUBTRACT`, `UNIFORM`, `WIDTH_BUCKET` | Not supported | |


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.