# clmm_tick_to_sqrt_price_x96

Converts a Uniswap-compatible tick to Q64.96 sqrt(currency1/currency0) with TickMath's bit-decomposed constants and final upward rounding. It is deterministic and propagates NULL.

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

- Kind: scalar function
- Category: [Fixed-point and AMM math](/docs/category/fixed-point-and-amm-math.md)
- Tags: Clmm Math, Deterministic, Offline, Types

Converts a Uniswap-compatible tick to Q64.96 sqrt(currency1/currency0) with TickMath's bit-decomposed constants and final upward rounding. It is deterministic and propagates NULL.

## Overload 1: clmm_tick_to_sqrt_price_x96(INTEGER)

```sql
clmm_tick_to_sqrt_price_x96(INTEGER)
```

Converts a Uniswap-compatible tick to Q64.96 sqrt(currency1/currency0) with TickMath's bit-decomposed constants and final upward rounding. It is deterministic and propagates NULL.

- 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

- `tick` (INTEGER; required; positional) — INTEGER tick in [-887272, 887272], where raw currency1/currency0 price is 1.0001^tick.

### Returns

Q64.96 square-root price

UINT256 sqrt(currency1 / currency0) * 2^96, rounded up exactly as Uniswap v4 TickMath; range [4295128739, 1461446703485210103287273052203988822378723970342]. NULL input returns NULL; an out-of-range tick errors.

- `sqrt_price_x96` (UINT256)

Q64.96 square-root price. UINT256 sqrt(currency1 / currency0) * 2^96, rounded up exactly as Uniswap v4 TickMath; range [4295128739, 1461446703485210103287273052203988822378723970342]. NULL input returns NULL; an out-of-range tick errors.

### Examples

_Local SQL · Local_

```sql
WITH price AS (
  SELECT clmm_tick_to_sqrt_price_x96(200311::INTEGER) AS sqrt_price_x96
)
SELECT
  sqrt_price_x96::VARCHAR AS sqrt_price_x96,
  format_units(
    divmul(
      (1::UINT256 << 192),
      sqrt_price_x96 * sqrt_price_x96,
      1000000000000000000::UINT256
    ),
    6
  ) AS usdc_per_weth
FROM price;
-- => [{"sqrt_price_x96":"1771577727172025373304338615273325","usdc_per_weth":"2000.040289"}]
```

## Guidance

### Uniswap v4-compatible local math boundary

These generic helpers follow Uniswap v4 core TickMath, SqrtPriceMath, SwapMath, and TickBitmap conventions. Q64.96 square-root price means sqrt(currency1 / currency0) * 2^96, using raw token units.

- Use them as deterministic evidence about one hydrated pool state, price range, bitmap word, or swap step.
- They do not fetch state, resolve dynamic fees or hooks, cross ticks and update liquidity, iterate bitmap words, apply slippage policy, select routes, produce calldata, or return a complete executable quote.
- Pin onchain reads before use. The six-argument swap-step fee denominator and the bitmap result diagnostics are Determica extensions, not Uniswap v4 interfaces.

```sql
WITH bounds AS (
  SELECT
    clmm_tick_to_sqrt_price_x96(-60) AS sqrt_price_a_x96,
    clmm_tick_to_sqrt_price_x96(60) AS sqrt_price_b_x96
)
SELECT clmm_amount0_delta_x96(
  sqrt_price_a_x96,
  sqrt_price_b_x96,
  1000000::UINT256,
  false
) AS amount0
FROM bounds;
```

## Related functions

- [clmm_sqrt_price_x96_to_tick](/docs/functions/clmm_sqrt_price_x96_to_tick.md) — Alternative
- [clmm_amount0_delta_x96](/docs/functions/clmm_amount0_delta_x96.md) — Usually Before
- [clmm_amount1_delta_x96](/docs/functions/clmm_amount1_delta_x96.md) — Usually Before
- [clmm_swap_step_x96](/docs/functions/clmm_swap_step_x96.md) — Usually Before
