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

# Mathematical Functions

The following table shows the mathematical functions that are available for the standard numeric types.

In the table below, the returned data type or value appears following the right arrow (⇒) sign.

| Function                                                                              | Description and Comments                                                | Example                                                  |
| :------------------------------------------------------------------------------------ | :---------------------------------------------------------------------- | :------------------------------------------------------- |
| `ABS(numeric_type) => numeric_type`                                                   | Absolute                                                                | `ABS(-88)`<br />=> 88                                    |
| `CEIL(DECIMAL) => DECIMAL` <br /> `CEIL(DOUBLE) => DOUBLE`                            | Nearest integer greater than or equal to argument<br />Alias: CEILING() | `CEIL(35.78)`<br />=> 36<br />`CEIL(-35.18)`<br />=> -35 |
| `DIV(y numeric_type, x numeric_type) => int_type`                                     | Integer quotient of y/x                                                 | `DIV(18, 3)`<br />=> 6<br />`DIV(18, 5)`<br />=> 3       |
| `EXP(DECIMAL) => DECIMAL` <br /> `EXP(DOUBLE) => DOUBLE`                              | Exponential                                                             | `EXP(1.0)`<br />=> 2.7182818284590452                    |
| `FLOOR(DECIMAL) => DECIMAL` <br /> `FLOOR(DOUBLE) => DOUBLE`                          | Nearest integer less than or equal to argument<br />See notes.          | `FLOOR(56.8)`<br />=> 56<br />`FLOOR(-56.8)`<br />=> -57 |
| `LN(DECIMAL) => DECIMAL` <br /> `LN(DOUBLE) => DOUBLE`                                | Natural logarithm                                                       | `LN(2.0)`<br />=> 0.6931471805599453                     |
| `LOG(DECIMAL) => DECIMAL` <br /> `LOG(DOUBLE) => DOUBLE`                              | Base 10 logarithm                                                       | `LOG(1000)`<br />=> 3                                    |
| `LOG(b DECIMAL, x DECIMAL) => DECIMAL`                                                | Logarithm of x to base b                                                | `LOG(2.0, 64)`<br />=> 6.0000000000000000                |
| `LOG10(DECIMAL) => DECIMAL` <br /> `LOG10(DOUBLE) => DOUBLE`                          | Base 10 logarithm, (same as LOG() with a single argument).              | `LOG10(1000)`<br />=> 3                                  |
| `MOD(y DECIMAL, x DECIMAL)`                                                           | Modulo<br />See notes.                                                  | `MOD(5, 3)`<br />=> 2                                    |
| `PI() => DOUBLE`                                                                      | Return the value of PI.                                                 | `PI()`<br />=> 3.141592653589793                         |
| `POWER(x DECIMAL, y DECIMAL) => DECIMAL` <br /> `POWER(x DOUBLE, y DOUBLE) => DOUBLE` | x raised to the power of y                                              | `POWER(27, 2)`<br />=> 729                               |
| `ROUND(DECIMAL [s INT]) => DECIMAL` <br /> `ROUND(DOUBLE) => DOUBLE`                  | Rounds to the nearest integer. s represents the optional scale accuracy | `ROUND(67.2)`<br />=> 67<br />`ROUND(67.8)`<br />=> 68   |
| `SIGN(DECIMAL) => DECIMAL` <br /> `SIGN(DOUBLE) => DOUBLE`                            | Sign of the argument (-1, 0, or +1)                                     | `SIGN(0), SIGN(-2), SIGN(5)`<br />=> 0, -1, 1            |
| `SQRT(DECIMAL) => DECIMAL` <br /> `SQRT(DOUBLE) => DOUBLE`                            | Square root                                                             | `SQRT(9)`<br />=> 3                                      |
| `TRUNC(DECIMAL) => DECIMAL` <br /> `TRUNC(DOUBLE) => DOUBLE`                          | Truncates to integer (towards zero)                                     | `TRUNC(67.89)`<br />=> 67                                |
| `TRUNC(x DECIMAL, s INT) => DECIMAL`                                                  | Truncates x to s decimal places.                                        | `TRUNC(67.89, 1)`<br />=> 67.8                           |

Note: `MOD()`: Arguments can be either `integral_type` (`INT`, `BIGINT`, `SMALLINT`) or `DECIMAL`. It cannot be floating-point numbers (`FLOAT` or `REAL`)
