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

# Fixed-point conventions

> Q128.128 price and fee-growth units in the current contract.

## Square-root price

The current contract stores square-root price as `u256::U256` in Q128.128 form.

```text theme={"languages":{"custom":["/languages/leo.tmLanguage.json"]}}
Q128 = 2^128
sqrt_ratio = sqrt_price_x128 / Q128
base-unit price(token1/token0) = sqrt_ratio^2
```

At tick zero, `sqrt_price_x128 = 2^128`. The value is `{ hi: 1, lo: 0 }` in `u256::U256` limbs.

Display price must also account for canonical token order and token display decimals. The contract itself uses native base units and stores no decimal scale.

## Fee growth

Global, outside, and inside fee growth also use Q128.128 `u256::U256` values:

```text theme={"languages":{"custom":["/languages/leo.tmLanguage.json"]}}
fee_owed = floor((fee_growth_now - fee_growth_last) * liquidity / 2^128)
```

Growth subtraction wraps modulo `2^256`. Whole token amounts must still fit `u128`.

## Wide arithmetic

Price and liquidity formulas use full-width multiplication and division. The contract selects floor or ceiling rounding for each operation. A quote engine must copy that order. Floating-point algebra is not transaction-safe.
