Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Query Methods

MethodReturnDescription
x.is_zero()BoolTrue if value is 0
x.is_negative()BoolTrue if value < 0
x.is_positive()BoolTrue if value > 0
x.is_one()BoolTrue if value is 1
x.bit_length()IntNumber of bits in the magnitude
x.bit_count()IntPopulation count (number of set bits)
x.number_of_words()IntNumber of UInt64 words
x.number_of_digits()IntNumber of decimal digits
var x = BInt(13)
print(x.bit_length())       # 4  (13 = 0b1101)
print(x.bit_count())        # 3  (three 1-bits)
print(x.number_of_digits()) # 2
print(x.is_positive())      # True