Count leading zeros 2026-10-25
The number of zero bits before the first one, reading a fixed-width binary representation from its most significant bit. The all-zero -bit input has count . Thus , and ; the width is part of the definition.
Most significant bit Created 2026-10-20 Updated 2026-11-05
The most significant bit is the binary digit with greatest positional weight in a specified binary representation. For a positive integer written without leading zeros, it is the leading one: in , it has weight .
For a fixed-width word, the term instead denotes the leftmost position even when that bit is zero. In two's-complement signed representation, that position is the sign bit. Stating the width and whether the value is signed prevents confusing the highest position of a word with the highest nonzero bit of an integer.
For the unsigned interpretation of the binary string, the set positions have weights . ThusIn 16-bit two's complement, the most significant bit is set, so subtract from that unsigned interpretation:For a half-precision floating-point number, split the fields at their actual boundaries rather than the printed groups of four:The sign is negative, the true exponent is , and the fraction is . It is a normal finite value, so