bit(
bit(
BIT
)

The bit( function converts a bit number (1 to 64) into a number (1, 2, 4, 8, 16, etc.)

Parameters

This function has one parameter:

bit – bit number from 1 to 64.

Description

This function converts a bit number (1 to 64) into a number (1, 2, 4, 8, 16, etc.)

    bit(1) ☞ 1
    bit(2) ☞ 2
    bit(3) ☞ 4
    bit(4) ☞ 8
    bit(12) ☞ 2048
    bit(31) ☞ 1073741824
    bit(50) ☞ 562949953421312

Note: This function is equivalent to:

    ?(bitnum=64,hex("8000000000000000"),fix(2^(bitnum-1)))

See Also

- getbit( -- returns the value of a bit within a number.
- onescomplement( -- returns the one's complement of a 64 bit number (all bits are reversed)
- setbit( -- sets or clears one bit within a number, without disturbing any of the other bits.

History

Version | Status | Notes
10.0 | Updated | Carried over from Panorama 6.0, but now supports up to 64 bits (instead of 32).