Skip to content

BitLength

BitLength(x)

gives the number of bits needed to represent the integer x. The sign of x is ignored.

Examples

>> BitLength(1023)
10
>> BitLength(100)
7
>> BitLength(-5)
3
>> BitLength(0)
0

Implementation status

  • ✅ - full supported

Github