> ## Documentation Index
> Fetch the complete documentation index at: https://docs.qu.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# fromTwos

```ts theme={null}
function fromTwos(_value, _width): bigint
```

Convert `value` from a twos-compliment representation of `width` bits to its value.

If the highest bit is `1`, the result will be negative.

## Parameters

| Parameter | Type                                                     | Description                     |
| :-------- | :------------------------------------------------------- | :------------------------------ |
| `_value`  | [`BigNumberish`](/sdk/content/type-aliases/BigNumberish) | The value to convert.           |
| `_width`  | [`Numeric`](/sdk/content/type-aliases/Numeric)           | The width of the value in bits. |

## Returns

`bigint`

The value.

## Throws

If the value is too large for the width.

## Source

[utils/maths.ts:42](https://github.com/dominant-strategies/quais.js/blob/c1c12d43f9d34c6baad2b0542bd6d0acd6fefcbf/src/utils/maths.ts#L42)
