corresponds to a power of 10 based on its position in the number The powers of 10 increment from 0, 1, 2, etc. as you move right to left 1,479 = 1 * 103 + 4 * 102 + 7 * 101 + 9 * 100
positional representation as shown previously From decimal to binary (or hex) Keep dividing by 2 (or 16) Remainders give the digits, starting from lowest power
Calculations: Write down powers of 2 Subtract the largest power of 2 that is less than the number Add a 1 if can subtract, and a 0 if cannot 22 6 2 32 16 8 4 2 1 0 1 0 1 1 0
Aztecs, Tlingit (Pacific Northwest Coast), Inuit, Yoruba language (Africa), Ainu language (Japan), Dzongkha language (Bhutan) Gettysburg Address "Four score and seven years ago…“ = 87 years ago
to indicate a sign, so all bits can be used for the magnitude: 1 byte = 8 bits = 28 = 256 (0 to 255) 255 decimal = 1111 1111 binary 2 bytes = 16 bits = 216 = 65,536 (0 to 65,535) 4 bytes = 32 bits = 232 = 4,294,967,296 (0 to 4,294,967,295)
= 1 (negative number) Convert to 1’s complement form (flip the bits) Convert to 2's complement form (add 1) Convert binary number to decimal number using positional representation as shown previously Put negative sign (-) in front of decimal number
to signed binary number Step #1: Convert the magnitude (number without the sign) from decimal to binary: keep dividing by 2, where remainders give the digits, starting from lowest power, as shown previously Step #2: Convert to 1’s complement form (flip the bits) Step #3: Convert to 2's complement form (add 1)
signed 8-bit binary number: -9 Step #1: Convert the magnitude (number without the sign) from decimal to binary 9 decimal = 0000 1001 binary (unsigned)
American Standard Code for Information Interchange Standard encoding scheme used to represent characters in binary format on computers 7-bit encoding, so 128 characters can be represented
"control characters" (cannot print) Ctrl-A or ^A is 1, ^B is 2, etc. Used for screen formatting and data communication 32 to 126 are printable characters
int y = 5; (y = 0x00000005;) In computer, y = 00000000 00000000 00000000 00000101 int z = -5; (y = 0xFFFFFFFB;) In computer, z = 11111111 11111111 11111111 11111011