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

# Numeric Functions

> Math operations: ROUND, ABS, CEIL, FLOOR, SQRT, and more

## Numeric functions

### ABS

Returns the absolute value.

```sql theme={null}
SELECT ABS(-5) -- 5
SELECT ABS(balance) AS absolute_balance FROM company_data."123"
```

### CEIL / CEILING

Rounds up to the nearest integer.

```sql theme={null}
SELECT CEIL(4.2)  -- 5
SELECT CEIL(-4.2) -- -4
```

### FLOOR

Rounds down to the nearest integer.

```sql theme={null}
SELECT FLOOR(4.8)  -- 4
SELECT FLOOR(-4.2) -- -5
```

### ROUND

Rounds to a specified number of decimal places.

```sql theme={null}
SELECT ROUND(4.567)     -- 5
SELECT ROUND(4.567, 2)  -- 4.57
SELECT ROUND(4.567, 0)  -- 5
```

### POWER / POW

Raises a number to a power.

```sql theme={null}
SELECT POWER(2, 3) -- 8
SELECT POW(10, 2)  -- 100
```

### SQRT

Returns the square root.

```sql theme={null}
SELECT SQRT(16) -- 4
SELECT SQRT(2)  -- 1.414...
```

### LN

Returns the natural logarithm.

```sql theme={null}
SELECT LN(2.718281828) -- ~1
```

### LOG10

Returns the base-10 logarithm.

```sql theme={null}
SELECT LOG10(100) -- 2
```

### EXP

Returns e raised to a power.

```sql theme={null}
SELECT EXP(1) -- 2.718...
```

### MOD

Returns the remainder after division.

```sql theme={null}
SELECT MOD(10, 3) -- 1
SELECT MOD(user_id, 100) AS bucket FROM company_data."123"
```

### GREATEST

Returns the largest value from a list.

```sql theme={null}
SELECT GREATEST(1, 5, 3) -- 5
SELECT GREATEST(score1, score2, score3) AS max_score FROM company_data."123"
```

### LEAST

Returns the smallest value from a list.

```sql theme={null}
SELECT LEAST(1, 5, 3) -- 1
SELECT LEAST(price1, price2) AS min_price FROM company_data."123"
```

***

## Related content

<CardGroup cols={2}>
  <Card title="Aggregate Functions" icon="chart-bar" href="/nql/functions/aggregate-functions">
    GROUP BY computations
  </Card>

  <Card title="Date & Time Functions" icon="clock" href="/nql/functions/date-time-functions">
    Temporal operations
  </Card>

  <Card title="All Functions" icon="function" href="/nql/functions/index">
    Browse all function categories
  </Card>

  <Card title="Data Types" icon="shapes" href="/nql/data-types">
    LONG, DOUBLE, and DECIMAL type reference
  </Card>
</CardGroup>
