Function nextPowerOfTwo

  • Method used to find the next power of two for a given number.

    Parameters

    • n: number

      The number for which to find the next power of two.

    Returns number

    The next power of two for the given number.

    Static

    Example

    nextPowerOfTwo(6);     // Returns 8
    nextPowerOfTwo(15); // Returns 16
  • Method used to find the next power of two for a given bigint.

    Parameters

    • n: bigint

      The bigint for which to find the next power of two.

    Returns bigint

    The next power of two for the given bigint.

    Static

    Example

    nextPowerOfTwo(6n);     // Returns 8n
    nextPowerOfTwo(15n); // Returns 16n

Generated using TypeDoc