贺一峰Yifeng He

Data Representation

, Science

Binary Representation

Everything in the computer is represented using a very simple binary coding scheme where the only symbols used are 0 and 1.

What can be represented by bits?

Number System

Base 10 Base 2 Base 8 Base 16
0 0000 0 0
1 0001 1 1
2 0010 2 2
3 0011 3 3
4 0100 4 4
5 0101 5 5
6 0110 6 6
7 0111 7 7
8 1000 10 8
9 1001 11 9
10 1010 12 A
11 1011 13 B
12 1100 14 C
13 1101 15 D
14 1110 16 E
15 1111 17 F

Signed Numbers

Signed Magnitude

Two’s Complement

take opposite of each bit, then add one

Characters

ASCII

American Standard Code for Information Interchange

Unicode

addition to ASCII that can represent more characters, covers lots of emojis and most existing languages.

More Information