Skip to content

bitLength

bitLength(value): number

Defined in: packages/core/src/number/integer/bit-length.ts:12

Number of bits in |value|, which is ⌊log₂|value|⌋ + 1. Zero for 0.

The number sibling of bigIntBitLength. Math.clz32 settles the low 32 bits directly; above that the value is split into two halves, since a safe integer needs at most 53 bits.

number

A safe integer; the fractional part of a non-integer is ignored.

number

The bit length, from 0 to 53.