Options
All
  • Public
  • Public/Protected
  • All
Menu

Interface IntegerType

Hierarchy

  • IntegerReturn
    • IntegerType

Index

Properties

mpz_t: number = 0
type: string = 'integer'

Methods

  • add<T>(val: T): OutputType<T>
  • Returns the sum of this number and the given one.

    Type parameters

    • T: AllTypes

    Parameters

    • val: T

    Returns OutputType<T>

  • Sets the value of bit i to 0. The least significant bit is number 0

    Parameters

    • index: number

    Returns IntegerType

  • Sets the value of multiple bits to 0. The least significant bit is number 0

    Parameters

    • indices: number[]

    Returns IntegerType

  • div<T>(val: T, mode?: DivMode): OutputType<T>
  • Returns the result of the division of this number by the given one.

    Type parameters

    • T: AllTypes

    Parameters

    Returns OutputType<T>

  • Inverts the value of bit i. The least significant bit is number 0

    Parameters

    • index: number

    Returns IntegerType

  • Inverts the value of multiple bits. The least significant bit is number 0

    Parameters

    • indices: number[]

    Returns IntegerType

  • Returns the greatest common divisor of this number and the given one.

    Parameters

    Returns IntegerType

  • getBit(index: number): number
  • Returns 0 or 1 based on the value of a bit at the provided index. The least significant bit is number 0

    Parameters

    • index: number

    Returns number

  • greaterOrEqual(val: AllTypes): boolean
  • Returns true if the current number is greater than or equal to the provided number

    Parameters

    • val: AllTypes

    Returns boolean

  • greaterThan(val: AllTypes): boolean
  • Returns true if the current number is greater than the provided number

    Parameters

    • val: AllTypes

    Returns boolean

  • isEqual(val: AllTypes): boolean
  • Returns true if the current number is equal to the provided number

    Parameters

    • val: AllTypes

    Returns boolean

  • isProbablyPrime(reps?: number): boolean | "probably-prime"
  • Determines whether a number is prime using some trial divisions, then reps Miller-Rabin probabilistic primality tests.

    Parameters

    • reps: number = 20

    Returns boolean | "probably-prime"

  • Returns the least common multiple of this number and the given one.

    Parameters

    Returns IntegerType

  • lessOrEqual(val: AllTypes): boolean
  • Returns true if the current number is less than or equal to the provided number

    Parameters

    • val: AllTypes

    Returns boolean

  • lessThan(val: AllTypes): boolean
  • Returns true if the current number is less than the provided number

    Parameters

    • val: AllTypes

    Returns boolean

  • msbPosition(): number
  • Returns number

  • mul<T>(val: T): OutputType<T>
  • Returns the product of this number and the given one.

    Type parameters

    • T: AllTypes

    Parameters

    • val: T

    Returns OutputType<T>

  • Identifies primes using a probabilistic algorithm; the chance of a composite passing will be extremely small.

    Returns IntegerType

  • Returns the truncated integer part of the nth root

    Parameters

    • nth: number

    Returns IntegerType

  • Sets the value of bit i to 1. The least significant bit is number 0

    Parameters

    • i: number

    Returns IntegerType

  • Sets the value of multiple bits to 1. The least significant bit is number 0

    Parameters

    • indices: number[]

    Returns IntegerType

  • Returns the integer left shifted by a given number of bits.

    Parameters

    • val: number

    Returns IntegerType

  • Returns the integer right shifted by a given number of bits.

    Parameters

    • val: number

    Returns IntegerType

  • sign(): 0 | 1 | -1
  • Returns the sign of the current value (-1 or 0 or 1)

    Returns 0 | 1 | -1

  • Works similarly to JS Array.slice() but on bits. The least significant bit is number 0

    Parameters

    • Optional start: number
    • Optional end: number

    Returns IntegerType

  • Returns the integer square root number, rounded down.

    Returns IntegerType

  • sub<T>(val: T): OutputType<T>
  • Returns the difference of this number and the given one.

    Type parameters

    • T: AllTypes

    Parameters

    • val: T

    Returns OutputType<T>

  • toBuffer(littleEndian?: boolean): Uint8Array
  • Exports integer into an Uint8Array. Sign is ignored.

    Parameters

    • littleEndian: boolean = false

    Returns Uint8Array

  • Converts the number to a floating-point number

    Returns FloatType

  • toNumber(): number
  • Converts current value into a JavaScript number

    Returns number

  • toString(radix?: number): string
  • Converts the number to string

    Parameters

    • radix: number = 10

    Returns string

  • Creates new integer with the copy of binary representation of num to position offset. Optionally bitCount can be used to zero-pad the number to a specific number of bits. The least significant bit is number 0

    Parameters

    • num: IntegerType
    • offset: number = 0
    • Optional bitCount: number

    Returns IntegerType

Generated using TypeDoc