Interface BigInteger

Index

Methods

Methods

public abs(): BigInteger

Returns the absolute value of a bigInt.

Returns

BigInteger

public add(number: number): BigInteger

Performs addition

Parameters

  • number: number

Returns

BigInteger

public add(number: BigInteger): BigInteger

Performs addition

Parameters

Returns

BigInteger

public add(number: string): BigInteger

Performs addition

Parameters

  • number: string

Returns

BigInteger

public compare(number: number): BigInteger

Performs a comparison between two numbers. If the numbers are equal, it returns 0. If the first number is greater, it returns 1. If the first number is lesser, it returns -1.

Parameters

  • number: number

Returns

BigInteger

public compare(number: BigInteger): BigInteger

Performs a comparison between two numbers. If the numbers are equal, it returns 0. If the first number is greater, it returns 1. If the first number is lesser, it returns -1.

Parameters

Returns

BigInteger

public compare(number: string): BigInteger

Performs a comparison between two numbers. If the numbers are equal, it returns 0. If the first number is greater, it returns 1. If the first number is lesser, it returns -1.

Parameters

  • number: string

Returns

BigInteger

public compareAbs(number: number): BigInteger

Performs a comparison between the absolute value of two numbers.

Parameters

  • number: number

Returns

BigInteger

public compareAbs(number: BigInteger): BigInteger

Performs a comparison between the absolute value of two numbers.

Parameters

Returns

BigInteger

public compareAbs(number: string): BigInteger

Performs a comparison between the absolute value of two numbers.

Parameters

  • number: string

Returns

BigInteger

public divide(number: number): BigInteger

Performs integer division, disregarding the remainder.

Parameters

  • number: number

Returns

BigInteger

public divide(number: BigInteger): BigInteger

Performs integer division, disregarding the remainder.

Parameters

Returns

BigInteger

public divide(number: string): BigInteger

Performs integer division, disregarding the remainder.

Parameters

  • number: string

Returns

BigInteger

public divmod(number: number): { quotient: BigInteger; remainder: BigInteger; }

Performs division and returns an object with two properties: quotient and remainder. The sign of the remainder will match the sign of the dividend.

Parameters

  • number: number

Returns

{ quotient: BigInteger; remainder: BigInteger; }

public divmod(number: BigInteger): { quotient: BigInteger; remainder: BigInteger; }

Performs division and returns an object with two properties: quotient and remainder. The sign of the remainder will match the sign of the dividend.

Parameters

Returns

{ quotient: BigInteger; remainder: BigInteger; }

public divmod(number: string): { quotient: BigInteger; remainder: BigInteger; }

Performs division and returns an object with two properties: quotient and remainder. The sign of the remainder will match the sign of the dividend.

Parameters

  • number: string

Returns

{ quotient: BigInteger; remainder: BigInteger; }

public equals(number: number): boolean

Checks if two numbers are equal.

Parameters

  • number: number

Returns

boolean

public equals(number: BigInteger): boolean

Checks if two numbers are equal.

Parameters

Returns

boolean

public equals(number: string): boolean

Checks if two numbers are equal.

Parameters

  • number: string

Returns

boolean

public greater(number: number): boolean

Checks if the first number is greater than the second.

Parameters

  • number: number

Returns

boolean

public greater(number: BigInteger): boolean

Checks if the first number is greater than the second.

Parameters

Returns

boolean

public greater(number: string): boolean

Checks if the first number is greater than the second.

Parameters

  • number: string

Returns

boolean

public greaterOrEquals(number: number): boolean

Checks if the first number is greater than or equal to the second.

Parameters

  • number: number

Returns

boolean

public greaterOrEquals(number: BigInteger): boolean

Checks if the first number is greater than or equal to the second.

Parameters

Returns

boolean

public greaterOrEquals(number: string): boolean

Checks if the first number is greater than or equal to the second.

Parameters

  • number: string

Returns

boolean

public isEven(): boolean

Returns true if the number is even, false otherwise.

Returns

boolean

public isNegative(): boolean

Returns true if the number is negative, false otherwise. Returns false for 0 and true for -0.

Returns

boolean

public isOdd(): boolean

Returns true if the number is odd, false otherwise.

Returns

boolean

public isPositive(): boolean

Return true if the number is positive, false otherwise. Returns true for 0 and false for -0.

Returns

boolean

public lesser(number: number): boolean

Checks if the first number is lesser than the second.

Parameters

  • number: number

Returns

boolean

public lesser(number: BigInteger): boolean

Checks if the first number is lesser than the second.

Parameters

Returns

boolean

public lesser(number: string): boolean

Checks if the first number is lesser than the second.

Parameters

  • number: string

Returns

boolean

public lesserOrEquals(number: number): boolean

Checks if the first number is less than or equal to the second.

Parameters

  • number: number

Returns

boolean

public lesserOrEquals(number: BigInteger): boolean

Checks if the first number is less than or equal to the second.

Parameters

Returns

boolean

public lesserOrEquals(number: string): boolean

Checks if the first number is less than or equal to the second.

Parameters

  • number: string

Returns

boolean

public minus(number: number): BigInteger

Alias for the subtract method.

Parameters

  • number: number

Returns

BigInteger

public minus(number: BigInteger): BigInteger

Alias for the subtract method.

Parameters

Returns

BigInteger

public minus(number: string): BigInteger

Alias for the subtract method.

Parameters

  • number: string

Returns

BigInteger

public mod(number: number): BigInteger

Performs division and returns the remainder, disregarding the quotient. The sign of the remainder will match the sign of the dividend.

Parameters

  • number: number

Returns

BigInteger

public mod(number: BigInteger): BigInteger

Performs division and returns the remainder, disregarding the quotient. The sign of the remainder will match the sign of the dividend.

Parameters

Returns

BigInteger

public mod(number: string): BigInteger

Performs division and returns the remainder, disregarding the quotient. The sign of the remainder will match the sign of the dividend.

Parameters

  • number: string

Returns

BigInteger

public multiply(number: number): BigInteger

Performs multiplication.

Parameters

  • number: number

Returns

BigInteger

public multiply(number: BigInteger): BigInteger

Performs multiplication.

Parameters

Returns

BigInteger

public multiply(number: string): BigInteger

Performs multiplication.

Parameters

  • number: string

Returns

BigInteger

public next(): BigInteger

Adds one to the number.

Returns

BigInteger

public notEquals(number: number): boolean

Checks if two numbers are not equal.

Parameters

  • number: number

Returns

boolean

public notEquals(number: BigInteger): boolean

Checks if two numbers are not equal.

Parameters

Returns

boolean

public notEquals(number: string): boolean

Checks if two numbers are not equal.

Parameters

  • number: string

Returns

boolean

public over(number: number): BigInteger

Alias for the divide method.

Parameters

  • number: number

Returns

BigInteger

public over(number: BigInteger): BigInteger

Alias for the divide method.

Parameters

Returns

BigInteger

public over(number: string): BigInteger

Alias for the divide method.

Parameters

  • number: string

Returns

BigInteger

public plus(number: number): BigInteger

Alias for the add method.

Parameters

  • number: number

Returns

BigInteger

public plus(number: BigInteger): BigInteger

Alias for the add method.

Parameters

Returns

BigInteger

public plus(number: string): BigInteger

Alias for the add method.

Parameters

  • number: string

Returns

BigInteger

public pow(number: number): BigInteger

Performs exponentiation. If the exponent is less than 0, pow returns 0. bigInt.zero.pow(0) returns 1.

Parameters

  • number: number

Returns

BigInteger

public pow(number: BigInteger): BigInteger

Performs exponentiation. If the exponent is less than 0, pow returns 0. bigInt.zero.pow(0) returns 1.

Parameters

Returns

BigInteger

public pow(number: string): BigInteger

Performs exponentiation. If the exponent is less than 0, pow returns 0. bigInt.zero.pow(0) returns 1.

Parameters

  • number: string

Returns

BigInteger

public prev(): BigInteger

Subtracts one from the number.

Returns

BigInteger

public subtract(number: number): BigInteger

Performs subtraction.

Parameters

  • number: number

Returns

BigInteger

public subtract(number: BigInteger): BigInteger

Performs subtraction.

Parameters

Returns

BigInteger

public subtract(number: string): BigInteger

Performs subtraction.

Parameters

  • number: string

Returns

BigInteger

public times(number: number): BigInteger

Alias for the multiply method.

Parameters

  • number: number

Returns

BigInteger

public times(number: BigInteger): BigInteger

Alias for the multiply method.

Parameters

Returns

BigInteger

public times(number: string): BigInteger

Alias for the multiply method.

Parameters

  • number: string

Returns

BigInteger

public toJSNumber(): number

Converts a bigInt into a native Javascript number. Loses precision for numbers outside the range.

Returns

number

public toString(): string

Converts a bigInt to a string.

Returns

string

public valueOf(): number

Converts a bigInt to a native Javascript number. This override allows you to use native arithmetic operators without explicit conversion.

Returns

number