Bit - Binary to Decimal

1 - About

Binary number to decimal

See Decimal - Decimal to Binary for the inverse

3 - Type

3.1 - Calculator

Windows calculator:

  • select the Programmer mode
  • select the BIN format
  • enter the bits
  • copy the DEC value

3.2 - Manual: Binary number with Radix to Decimal

Binary number with Radix to Decimal


1101.101

The binary number 1101.101 has the following digits:

Power of 2 3 2 1 0 −1 −2 −3
Binary digit 1 1 0 1 . 1 0 1

In Decimal, you get:

<math> \begin{array}{llr} 1101.101_2 &= 1 \times 2^3 + 1 \times 2^2 + 0 \times 2^1 + 1 \times 2^0 + 1 \times 2^{-1} + 0 \times 2^{-2} + 1 \times 2^{-3} \\ &= 1 \times 8 + 1 \times 4 + 0 \times 2 + 1 \times 1 + 1 \times 0.5 + 0 \times 0.25 + 1 \times 0.125 \\ &= 8 + 4 + 0 + 1 + 0.5 + 0 + 0.125 \\ &= 13.625_{10} \end{array} </math>

3.3 - Python - Mapping generation

Python representation code to generate the mapping between decimal number and binary number (It work also in an other base)


base = 2
digits = set(range(base))
{((base**2)*a + base*b + c):[a,b,c] for a in digits for b in digits for c in digits}

Output:


0: [0, 0, 0]
1: [0, 0, 1]
2: [0, 1, 0]
3: [0, 1, 1]
4: [1, 0, 0]
5: [1, 0, 1]
6: [1, 1, 0]
7: [1, 1, 1]

4 - Documentation / Reference


Data Science
Data Analysis
Statistics
Data Science
Linear Algebra Mathematics
Trigonometry

Powered by ComboStrap