# Fixed-point and AMM math

Fixed-point and AMM math functions with exact signatures, examples, and catalog metadata.

Canonical HTML: <https://determica.com/docs/category/fixed-point-and-amm-math>

Calculate fixed-point values, liquidity, prices, and swap amounts with exact integer arithmetic.

- [clmm_amount0_delta_x96](/docs/functions/clmm_amount0_delta_x96.md) — Computes the Uniswap v4 SqrtPriceMath currency0 delta between two Q64.96 boundaries. Determica requires non-zero uint128 liquidity; arithmetic is deterministic and NULL propagates.
- [clmm_amount1_delta_x96](/docs/functions/clmm_amount1_delta_x96.md) — Computes the Uniswap v4 SqrtPriceMath currency1 delta between two Q64.96 boundaries. Determica requires non-zero uint128 liquidity; arithmetic is deterministic and NULL propagates.
- [clmm_bitmap_next_initialized_tick](/docs/functions/clmm_bitmap_next_initialized_tick.md) — Scans exactly one Uniswap v4-style compressed tick bitmap word. Compression rounds negative non-multiples toward negative infinity. It is deterministic, propagates NULL, and does not fetch adjacent words.
- [clmm_next_sqrt_price_from_input_x96](/docs/functions/clmm_next_sqrt_price_from_input_x96.md) — Computes the Uniswap v4 SqrtPriceMath next Q64.96 price for exact input. It is deterministic and propagates NULL.
- [clmm_next_sqrt_price_from_output_x96](/docs/functions/clmm_next_sqrt_price_from_output_x96.md) — Computes the Uniswap v4 SqrtPriceMath next Q64.96 price for exact output. It is deterministic and propagates NULL.
- [clmm_sqrt_price_x96_to_tick](/docs/functions/clmm_sqrt_price_x96_to_tick.md) — Inverts a Q64.96 sqrt(currency1/currency0) using Uniswap v4 TickMath floor semantics. It is deterministic and propagates NULL.
- [clmm_swap_step_x96](/docs/functions/clmm_swap_step_x96.md) — Computes one Uniswap v4 SwapMath-compatible price-range step. Negative amount_remaining means exact input; non-negative means exact output. Direction is inferred from current versus target. Hooks, dynamic fee resolution, tick-crossing liquidity changes, multi-word iteration, slippage, routing, and calldata are outside this deterministic helper. The five-argument overload uses Uniswap v4's 1,000,000 fee denominator.
- [clmm_tick_to_sqrt_price_x96](/docs/functions/clmm_tick_to_sqrt_price_x96.md) — 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.
- [fixed_div](/docs/functions/fixed_div.md) — Computes fixed-point division as x * scale / y with a full 512-bit intermediate product. The caller owns the units and scale: this function does not require decimal, WAD, or Q-format inputs. It is pure and deterministic despite remaining registered VOLATILE for compatibility. NULL input propagates to NULL. A zero y or a rounded quotient above UINT256 raises an error.
- [fixed_mul](/docs/functions/fixed_mul.md) — Computes fixed-point multiplication as x * y / scale with a full 512-bit intermediate product. The caller owns the units and scale: this function does not require decimal, WAD, or Q-format inputs. It is pure and deterministic despite remaining registered VOLATILE for compatibility. NULL input propagates to NULL. A zero scale or a rounded quotient above UINT256 raises an error.
