# valueToBigInt

> For the complete documentation index, see [llms.txt](https://docs.midnight.network/llms.txt)

[**@midnight-ntwrk/compact-runtime v0.21.0**](https://docs.midnight.network/api-reference/compact-runtime.md)

***

[@midnight-ntwrk/compact-runtime](https://docs.midnight.network/api-reference/compact-runtime/globals.md) / valueToBigInt

# Function: valueToBigInt()

```
function valueToBigInt(x): bigint;
```

**`Internal`**

Internal conversion between field-aligned binary values and bigints within the scalar field

## Parameters[​](#parameters "Direct link to Parameters")

### x[​](#x "Direct link to x")

[`Value`](https://docs.midnight.network/api-reference/compact-runtime/type-aliases/Value.md)

## Returns[​](#returns "Direct link to Returns")

`bigint`

## Throws[​](#throws "Direct link to Throws")

If the value does not encode a field element
