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

# Mathematics

> The trigonometric, logarithmic, and rounding functions available in Bunny Database, and how they differ from SQLite's built-in math functions.

The math functions are not SQLite's own [built-in math functions](https://www.sqlite.org/lang_mathfunc.html). They come from a bundled extension that mirrors most of that set, with a few differences that matter when porting SQL.

> [!WARNING]
>
> * `log(x)` is the **natural** logarithm. Use `log10(x)` for base 10. The two-argument form `log(base, x)` and `log2(x)` are not available.
> * `ceil()`, `ceiling()`, and `floor()` return an **integer** rather than a real.
> * `power(x, y)` is available, but `pow()`, `trunc()`, and `mod()` are not.

## Functions

| Function | What it does |
| - | - |
| `acos`, `acosh`, `asin`, `asinh`, `atan`, `atan2`, `atanh` | Inverse trigonometric and hyperbolic functions, in radians. |
| `cos`, `cosh`, `sin`, `sinh`, `tan`, `tanh` | Trigonometric and hyperbolic functions. |
| `cot(x)`, `coth(x)` | Cotangent and hyperbolic cotangent. |
| `atn2(y, x)` | Alias of `atan2()`. |
| `exp(x)`, `ln(x)`, `log(x)`, `log10(x)` | Exponential, natural logarithm (both `ln` and `log`), base-10 logarithm. |
| `power(x, y)`, `sqrt(x)`, `square(x)` | Power, square root, and `x` multiplied by itself. `power()` returns a real. |
| `ceil(x)`, `ceiling(x)`, `floor(x)` | Rounding up and down. Return an integer. |
| `sign(x)` | -1, 0, or 1. Returns `NULL` for non-numeric input. |
| `degrees(x)`, `radians(x)`, `pi()` | Angle conversion and the constant pi. |

```sql theme={null}
SELECT log(100);           -- 4.60517 (natural log)
SELECT log10(1000);        -- 3.0
SELECT power(2, 10);       -- 1024.0
SELECT typeof(ceil(1.2));  -- integer
```

## Edge cases

`sqrt()` of a negative number returns `NULL`. Other domain errors, such as `acos(2)` or `log(-1)`, raise an error.

`ln(0)` raises an error.


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