Js.BigintSourceProvide utilities for bigint
The BigInt type, representing arbitrary precision integers
of_string s creates a BigInt from a string representation. Supports decimal, hexadecimal (0x prefix), binary (0b prefix), and octal (0o prefix) formats. Whitespace is trimmed. Empty string returns 0. Invalid strings return 0.
of_string_exn s creates a BigInt from a string representation. Like of_string but raises Failure on invalid input.
to_string ?radix bigint returns a string representation. radix can be 2-36 (default 10).
to_float bigint converts to float. May lose precision for large values.
div x y returns x / y, truncated toward zero. Raises Division_by_zero if y is zero.
rem x y returns the remainder of x / y. The sign follows the dividend (JavaScript semantics). Raises Division_by_zero if y is zero.
pow base exp returns base raised to the power exp. Raises Invalid_argument if exp is negative.
shift_right x n returns x arithmetically shifted right by n bits. Sign-extending for negative numbers.
as_int_n bits x wraps x to a signed integer of bits bits. Equivalent to JavaScript's BigInt.asIntN.