# Tick Math

* **Name**: `evoswap::tick_math`
* **Description**: This module provides functions to work with ticks and their corresponding square root prices. In EVO, the square root price is represented in a fixed-point format 48x80, using a `u128` number.

#### Sqrt Price Formula <a href="#sqrt-price-formula" id="sqrt-price-formula"></a>

To compute the client-side square root price (`sqrt_price_x80`), use the following formula:

`sqrt_price_x80 = floor(sqrt(price) * 2^80)`

For example, if the price is 1.5, then:

`sqrt_price_x80 = floor(sqrt(1.5) * 2^80) = 1480625697465890259337216`

## Public Functions <a href="#public-functions" id="public-functions"></a>

**Calculate Tick from Square Root Price**

CommentShare feedback on the editorCalculates the tick value corresponding to a given square root price.

```
public fun get_tick_at_sqrt_price(sqrt_price: u128): u32
```

**Function Parameters**

| `sqrt_price` | `u128` | The square root price in fixed-point format 48x80. |
| ------------ | ------ | -------------------------------------------------- |

**Return Value**

| `u32` | The tick value corresponding to the given sqrt\_price. |
| ----- | ------------------------------------------------------ |


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.evo.market/technical/clmm/examples/tick-math.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
