# Math

### Description <a href="#description" id="description"></a>

This is a library contract that provides math functions on fractional numbers, performing arithmetic with unsigned [fixed-point decimals](https://en.wikipedia.org/wiki/Fixed-point_arithmetic).

Math uses OpenZeppelin's SafeMath library and SafeDecimalMath library for most of its basic arithmetic operations in order to protect from arithmetic overflows and zero divisions.

**Source:** contracts/Math.sol

### Internal Functions <a href="#internal-functions" id="internal-functions"></a>

#### `powDecimal` <a href="#powdecimal" id="powdecimal"></a>

Source

Returns the exponentiation of the base (x) integer by the n^th power to precision of 18 decimals. Function calculates the result using exponentiation by squaring, handling preciison loss by truncation and removes the order of magnitude introduced with integer arithmetics each time the base is squared.


---

# 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://perifinance.gitbook.io/peri-finance2021/development-resources/source-code-description/libraries/untitled-3.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.
