> For the complete documentation index, see [llms.txt](https://docs.servoy.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.servoy.com/reference/servoycore/dev-api/js-lib/bigint.md).

# BigInt

## Overview

The javascript BigInt implementation.\
BigInt is a built-in object that provides a way to represent whole numbers larger than 2^53-1. For more information see: [BigInt (MDN)](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/BigInt).

## Methods Summarized

| Type                                                     | Name                                                                | Summary                                                                                                                  |
| -------------------------------------------------------- | ------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------ |
| [BigInt](/reference/servoycore/dev-api/js-lib/bigint.md) | [asIntN(bits)](#asintn-bits)                                        | Returns a BigInt limited to a signed integer value of n bits.                                                            |
| [BigInt](/reference/servoycore/dev-api/js-lib/bigint.md) | [asUintN(bits)](#asuintn-bits)                                      | Returns a BigInt limited to an unsigned integer value of n bits.                                                         |
| [String](/reference/servoycore/dev-api/js-lib/string.md) | [toLocaleString()](#tolocalestring)                                 | Converts the BigInt value to a locale-sensitive string representation.                                                   |
| [String](/reference/servoycore/dev-api/js-lib/string.md) | [toLocaleString(locales)](#tolocalestring-locales)                  | Converts the BigInt value to a locale-sensitive string representation.                                                   |
| [String](/reference/servoycore/dev-api/js-lib/string.md) | [toLocaleString(locales, options)](#tolocalestring-locales-options) | Converts the BigInt value to a locale-sensitive string representation with the specified locales and formatting options. |
| [String](/reference/servoycore/dev-api/js-lib/string.md) | [toString()](#tostring)                                             | Converts the BigInt value to a string using the default base (10).                                                       |
| [String](/reference/servoycore/dev-api/js-lib/string.md) | [toString(radix)](#tostring-radix)                                  | Converts the BigInt value to a string in a specified base.                                                               |
| [BigInt](/reference/servoycore/dev-api/js-lib/bigint.md) | [valueOf()](#valueof)                                               | Returns the primitive value of the BigInt object.                                                                        |

## Methods Detailed

### asIntN(bits)

Returns a BigInt limited to a signed integer value of n bits.

**Parameters**

* [Number](/reference/servoycore/dev-api/js-lib/number.md) **bits** The number of bits to retain.

**Returns:** [BigInt](/reference/servoycore/dev-api/js-lib/bigint.md) A new BigInt limited to n signed bits.

**Sample**

```js
BigInt.asIntN(8, 257n);
```

### asUintN(bits)

Returns a BigInt limited to an unsigned integer value of n bits.

**Parameters**

* [Number](/reference/servoycore/dev-api/js-lib/number.md) **bits** The number of bits to retain.

**Returns:** [BigInt](/reference/servoycore/dev-api/js-lib/bigint.md) A new BigInt limited to n unsigned bits.

**Sample**

```js
BigInt.asUintN(8, 257n);
```

### toLocaleString()

Converts the BigInt value to a locale-sensitive string representation.

**Returns:** [String](/reference/servoycore/dev-api/js-lib/string.md) The locale-sensitive string representation of the BigInt using the default locale.

**Sample**

```js
BigInt(123456789123456789)toLocaleString();
```

### toLocaleString(locales)

Converts the BigInt value to a locale-sensitive string representation.

**Parameters**

* [String](/reference/servoycore/dev-api/js-lib/string.md) **locales** A string with a BCP 47 language tag, or an array of such strings. Corresponds to the locales parameter of the Intl.NumberFormat() constructor.

**Returns:** [String](/reference/servoycore/dev-api/js-lib/string.md) The locale-sensitive string representation of the BigInt.

**Sample**

```js
BigInt(123456789123456789).toLocaleString('de-DE');
```

### toLocaleString(locales, options)

Converts the BigInt value to a locale-sensitive string representation with the specified locales and formatting options.

**Parameters**

* [String](/reference/servoycore/dev-api/js-lib/string.md) **locales** A string with a BCP 47 language tag, or an array of such strings.
* [Object](/reference/servoycore/dev-api/js-lib/object.md) **options** An object with formatting options, such as \`useGrouping\` and \`minimumIntegerDigits\`.

**Returns:** [String](/reference/servoycore/dev-api/js-lib/string.md) The locale-sensitive string representation of the BigInt using the specified locale(s) and options.

**Sample**

```js
123456789012345678901234567890n.toLocaleString("de-DE", { style: 'currency', currency: 'EUR' });
```

### toString()

Converts the BigInt value to a string using the default base (10).

**Returns:** [String](/reference/servoycore/dev-api/js-lib/string.md) The string representation of the BigInt in base 10.

**Sample**

```js
/** @type {BigInt} */
let b = 1024n;
b.toString();
```

### toString(radix)

Converts the BigInt value to a string in a specified base.

**Parameters**

* [Number](/reference/servoycore/dev-api/js-lib/number.md) **radix** An integer between 2 and 36 that specifies the base of the returned string.

**Returns:** [String](/reference/servoycore/dev-api/js-lib/string.md) The string representation of the BigInt in the specified base.

**Sample**

```js
/** @type {BigInt} */
let b = 1024n;
b.toString(16);
```

### valueOf()

Returns the primitive value of the BigInt object.

**Returns:** [BigInt](/reference/servoycore/dev-api/js-lib/bigint.md) The primitive BigInt value.

**Sample**

```js
123n.valueOf();
```

***


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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, and the optional `goal` query parameter:

```
GET https://docs.servoy.com/reference/servoycore/dev-api/js-lib/bigint.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
