Module Js.Bigint

Bindings to functions in JavaScript's BigInt

JavaScript BigInt API

type t = Js.bigint;
let make: 'a => t;

make repr creates a new BigInt from the representation repr. repr can be a number, a string, boolean, etc.

let asIntN: precision:int => t => t;

asIntN ~precision bigint truncates the BigInt value of bigint to the given number of least significant bits specified by precision and returns that value as a signed integer.

let asUintN: precision:int => t => t;

asUintN ~precision bigint truncates the BigInt value of bigint to the given number of least significant bits specified by precision and returns that value as an unsigned integer.

type toLocaleStringOptions = {
  1. style: string,
  2. currency: string,
};
let toLocaleString: locale:string => ?options:toLocaleStringOptions => t => string;

toLocaleString bigint returns a string with a language-sensitive representation of this BigInt.

let toString: t => string;

toString bigint returns a string representing the specified BigInt value.

let neg: t => t;
let add: t => t => t;
let sub: t => t => t;

Subtraction.

let mul: t => t => t;

Multiplication.

let div: t => t => t;

Division.

let rem: t => t => t;