> ## Documentation Index
> Fetch the complete documentation index at: https://creator-a1160a86.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Utility Functions

The SDK provides several utility functions for calculations and type conversions.

## Math Functions

### divRem

Performs division and returns the quotient and remainder.

**Parameters**

**numerator** `number` *required*

The numerator.

**denominator** `number` *required*

The denominator.

**Returns**

**Returns** `[number, number]`

An array containing the quotient and remainder.

### mulDiv

Multiplies two numbers and then divides by a denominator, with rounding.

**Parameters**

**x** `number` *required*

The first number.

**y** `number` *required*

The second number.

**denominator** `number` *required*

The denominator.

**rounding** `'up' | 'down'` *required*

The rounding direction.

**Returns**

**Returns** `number`

The result of the calculation.

### mulShr

Multiplies two numbers and then right-shifts the result.

**Parameters**

**x** `number` *required*

The first number.

**y** `number` *required*

The second number.

**offset** `number` *required*

The number of bits to shift.

**rounding** `'up' | 'down'` *required*

The rounding direction.

**Returns**

**Returns** `number`

The result of the calculation.

### shlDiv

Left-shifts a number and then divides by another number.

**Parameters**

**x** `number` *required*

The number to shift.

**y** `number` *required*

The divisor.

**offset** `number` *required*

The number of bits to shift.

**rounding** `'up' | 'down'` *required*

The rounding direction.

**Returns**

**Returns** `number`

The result of the calculation.

## Price Functions

### getPriceFromId

Calculates the price from a bin ID.

**Parameters**

**bin\_step** `number` *required*

The bin step of the liquidity pool.

**bin\_id** `number` *required*

The ID of the bin.

**baseTokenDecimal** `number` *required*

The decimals of the base token.

**quoteTokenDecimal** `number` *required*

The decimals of the quote token.

**Returns**

**Returns** `number`

The price.

### getIdFromPrice

Calculates the bin ID from a price.

**Parameters**

**price** `number` *required*

The price.

**binStep** `number` *required*

The bin step of the liquidity pool.

**baseTokenDecimal** `number` *required*

The decimals of the base token.

**quoteTokenDecimal** `number` *required*

The decimals of the quote token.

**Returns**

**Returns** `number`

The bin ID.

## Type Conversion Functions

### pairAccountToPair

Converts a `PairAccount` object to a `Pair` object.

**Parameters**

**account** `PairAccount` *required*

The `PairAccount` object.

**Returns**

**Returns** `Pair`

The `Pair` object.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.