# Decimal

## Functions

### zero

```solidity
function zero() internal returns (struct Decimal.D256)
```

### one

```solidity
function one() internal returns (struct Decimal.D256)
```

### from

```solidity
function from(
    uint256 a
) internal returns (struct Decimal.D256)
```

#### Parameters

| Name | Type    | Description |
| ---- | ------- | ----------- |
| `a`  | uint256 |             |

### ratio

```solidity
function ratio(
    uint256 a,
    uint256 b
) internal returns (struct Decimal.D256)
```

#### Parameters

| Name | Type    | Description |
| ---- | ------- | ----------- |
| `a`  | uint256 |             |
| `b`  | uint256 |             |

### add

```solidity
function add(
    struct Decimal.D256 self,
    uint256 b
) internal returns (struct Decimal.D256)
```

#### Parameters

| Name   | Type                | Description |
| ------ | ------------------- | ----------- |
| `self` | struct Decimal.D256 |             |
| `b`    | uint256             |             |

### sub

```solidity
function sub(
    struct Decimal.D256 self,
    uint256 b
) internal returns (struct Decimal.D256)
```

#### Parameters

| Name   | Type                | Description |
| ------ | ------------------- | ----------- |
| `self` | struct Decimal.D256 |             |
| `b`    | uint256             |             |

### sub

```solidity
function sub(
    struct Decimal.D256 self,
    uint256 b,
    string reason
) internal returns (struct Decimal.D256)
```

#### Parameters

| Name     | Type                | Description |
| -------- | ------------------- | ----------- |
| `self`   | struct Decimal.D256 |             |
| `b`      | uint256             |             |
| `reason` | string              |             |

### mul

```solidity
function mul(
    struct Decimal.D256 self,
    uint256 b
) internal returns (struct Decimal.D256)
```

#### Parameters

| Name   | Type                | Description |
| ------ | ------------------- | ----------- |
| `self` | struct Decimal.D256 |             |
| `b`    | uint256             |             |

### div

```solidity
function div(
    struct Decimal.D256 self,
    uint256 b
) internal returns (struct Decimal.D256)
```

#### Parameters

| Name   | Type                | Description |
| ------ | ------------------- | ----------- |
| `self` | struct Decimal.D256 |             |
| `b`    | uint256             |             |

### pow

```solidity
function pow(
    struct Decimal.D256 self,
    uint256 b
) internal returns (struct Decimal.D256)
```

#### Parameters

| Name   | Type                | Description |
| ------ | ------------------- | ----------- |
| `self` | struct Decimal.D256 |             |
| `b`    | uint256             |             |

### add

```solidity
function add(
    struct Decimal.D256 self,
    struct Decimal.D256 b
) internal returns (struct Decimal.D256)
```

#### Parameters

| Name   | Type                | Description |
| ------ | ------------------- | ----------- |
| `self` | struct Decimal.D256 |             |
| `b`    | struct Decimal.D256 |             |

### sub

```solidity
function sub(
    struct Decimal.D256 self,
    struct Decimal.D256 b
) internal returns (struct Decimal.D256)
```

#### Parameters

| Name   | Type                | Description |
| ------ | ------------------- | ----------- |
| `self` | struct Decimal.D256 |             |
| `b`    | struct Decimal.D256 |             |

### sub

```solidity
function sub(
    struct Decimal.D256 self,
    struct Decimal.D256 b,
    string reason
) internal returns (struct Decimal.D256)
```

#### Parameters

| Name     | Type                | Description |
| -------- | ------------------- | ----------- |
| `self`   | struct Decimal.D256 |             |
| `b`      | struct Decimal.D256 |             |
| `reason` | string              |             |

### mul

```solidity
function mul(
    struct Decimal.D256 self,
    struct Decimal.D256 b
) internal returns (struct Decimal.D256)
```

#### Parameters

| Name   | Type                | Description |
| ------ | ------------------- | ----------- |
| `self` | struct Decimal.D256 |             |
| `b`    | struct Decimal.D256 |             |

### div

```solidity
function div(
    struct Decimal.D256 self,
    struct Decimal.D256 b
) internal returns (struct Decimal.D256)
```

#### Parameters

| Name   | Type                | Description |
| ------ | ------------------- | ----------- |
| `self` | struct Decimal.D256 |             |
| `b`    | struct Decimal.D256 |             |

### equals

```solidity
function equals(
    struct Decimal.D256 self,
    struct Decimal.D256 b
) internal returns (bool)
```

#### Parameters

| Name   | Type                | Description |
| ------ | ------------------- | ----------- |
| `self` | struct Decimal.D256 |             |
| `b`    | struct Decimal.D256 |             |

### greaterThan

```solidity
function greaterThan(
    struct Decimal.D256 self,
    struct Decimal.D256 b
) internal returns (bool)
```

#### Parameters

| Name   | Type                | Description |
| ------ | ------------------- | ----------- |
| `self` | struct Decimal.D256 |             |
| `b`    | struct Decimal.D256 |             |

### lessThan

```solidity
function lessThan(
    struct Decimal.D256 self,
    struct Decimal.D256 b
) internal returns (bool)
```

#### Parameters

| Name   | Type                | Description |
| ------ | ------------------- | ----------- |
| `self` | struct Decimal.D256 |             |
| `b`    | struct Decimal.D256 |             |

### greaterThanOrEqualTo

```solidity
function greaterThanOrEqualTo(
    struct Decimal.D256 self,
    struct Decimal.D256 b
) internal returns (bool)
```

#### Parameters

| Name   | Type                | Description |
| ------ | ------------------- | ----------- |
| `self` | struct Decimal.D256 |             |
| `b`    | struct Decimal.D256 |             |

### lessThanOrEqualTo

```solidity
function lessThanOrEqualTo(
    struct Decimal.D256 self,
    struct Decimal.D256 b
) internal returns (bool)
```

#### Parameters

| Name   | Type                | Description |
| ------ | ------------------- | ----------- |
| `self` | struct Decimal.D256 |             |
| `b`    | struct Decimal.D256 |             |

### isZero

```solidity
function isZero(
    struct Decimal.D256 self
) internal returns (bool)
```

#### Parameters

| Name   | Type                | Description |
| ------ | ------------------- | ----------- |
| `self` | struct Decimal.D256 |             |

### asUint256

```solidity
function asUint256(
    struct Decimal.D256 self
) internal returns (uint256)
```

#### Parameters

| Name   | Type                | Description |
| ------ | ------------------- | ----------- |
| `self` | struct Decimal.D256 |             |

### getPartial

```solidity
function getPartial(
    uint256 target,
    uint256 numerator,
    uint256 denominator
) private returns (uint256)
```

#### Parameters

| Name          | Type    | Description |
| ------------- | ------- | ----------- |
| `target`      | uint256 |             |
| `numerator`   | uint256 |             |
| `denominator` | uint256 |             |

### compareTo

```solidity
function compareTo(
    struct Decimal.D256 a,
    struct Decimal.D256 b
) private returns (uint256)
```

#### Parameters

| Name | Type                | Description |
| ---- | ------------------- | ----------- |
| `a`  | struct Decimal.D256 |             |
| `b`  | struct Decimal.D256 |             |


---

# 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.essencefinance.io/development/smart-contracts/external/decimal.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.
