Home

0b101000100010

0b101000100010 is a binary literal used in programming to specify a number in base 2. The sequence of twelve binary digits, 101000100010, encodes a single integer value when interpreted by a computer.

As an unsigned 12-bit value, it equals 2594 in decimal and 0xA22 in hexadecimal. The bits set

In practice, such a literal may be used for bitwise operations, masks, flags, or to initialize registers

The 0b prefix is common in languages that support binary literals, including Python and JavaScript, among others.

See also: Binary numeral system; Binary literals.

are
at
positions
11,
9,
5,
and
1
(counting
from
the
least
significant
bit
as
0),
corresponding
to
2^11
+
2^9
+
2^5
+
2^1.
in
hardware-oriented
code.
Bit
patterns
like
this
can
represent
status
fields,
configuration
options,
or
compact
data
encodings
in
low-level
software
and
embedded
systems.
In
a
fixed-width
signed
interpretation,
the
most
significant
bit
may
indicate
a
negative
value
(for
example,
in
a
12-bit
two's
complement
interpretation
the
value
would
be
-1502),
but
typical
code
uses
wider
widths
and
treats
0b101000100010
as
unsigned
unless
a
signed
type
is
explicitly
applied.