@neumatter/big-integer
Version:
An extendable class representing JavaScript's bigint data type.
56 lines (38 loc) • 1.31 kB
TypeScript
import type ByteView from 'byteview'
declare module '@neumatter/big-integer'
export type BigIntegerLike = number | string | bigint | boolean | BigInteger
export interface BigIntegerJSON {
type: 'BigInteger'
data: string
}
export default class BigInteger {
static isPrime (p: BigInteger): boolean
static nthPrime (nth: BigInteger): bigint
static from (value: BigIntegerLike | BigIntegerJSON | Uint8Array | ByteView): BigInteger
static random (bitLength: number): BigInteger
constructor (value: BigIntegerLike)
get bitLength (): number
get roundedBitLength (): number
valueOf (): bigint
/**
*
* @returns {number} Within `2 ** 53 - 1` range
*/
toNumber (): number
/**
*
* @param {number} radix Specifies a radix for converting numeric values to strings.
* @returns {string}
*/
toString (radix?: number): string
/**
* Returns a string representation appropriate to the host environment's current locale.
*
* @param {Intl.LocalesArgument | undefined} locales
* @param {BigIntToLocaleStringOptions | undefined} options
* @returns {string}
*/
toLocaleString (locales?: Intl.LocalesArgument | undefined, options?: BigIntToLocaleStringOptions | undefined): string
get [Symbol.toStringTag] (): string
toJSON (): BigIntegerJSON
}