# evm_sqrt

Returns the floor integer square root of a UINT256 value using overflow-safe Newton iteration. Defined for the full UINT256 range. NULL input propagates to NULL.

Canonical HTML: <https://determica.com/docs/functions/evm_sqrt>

- Kind: scalar function
- Category: [EVM utilities](/docs/category/evm-utilities.md)
- Tags: Types, EVM

Returns the floor integer square root of a UINT256 value using overflow-safe Newton iteration. Defined for the full UINT256 range. NULL input propagates to NULL.

## Overload 1: evm_sqrt(UINT256)

```sql
evm_sqrt(UINT256)
```

Returns the greatest UINT256 r such that r * r <= x.

- Kind: scalar
- Execution context: Offline
- Behavior: Transform
- Execution modes: Offline
- Input shape: Scalar Arguments
- Planning contract: Runtime
- Cardinality: One Per Input
- Determinism: Deterministic
- Return shape: Scalar
- Schema stability: Fixed
- Stability: Stable
- Side effects: None documented

### Inputs

- `x` (UINT256; required; positional) — UINT256 value in the inclusive range 0 through UINT256_MAX.

### Returns

Floor square root

UINT256 floor(sqrt(x)), or NULL when x is NULL.

- `sqrt` (UINT256)

Floor square root. UINT256 floor(sqrt(x)), or NULL when x is NULL.

### Examples

_Local SQL · Local_

```sql
SELECT evm_sqrt(10::UINT256)::VARCHAR AS result;
-- => [{"result":"3"}]
```

## Related functions

- [muldiv](/docs/functions/muldiv.md) — See Also
- [fixed_mul](/docs/functions/fixed_mul.md) — See Also
- [fixed_div](/docs/functions/fixed_div.md) — See Also
