Download presentation
Presentation is loading. Please wait.
1
1 Harvard University CSCI E-2a Life, Liberty, and Happiness After the Digital Explosion 3B: Representation
2
2 Binary counting 1+1=10, or 1+1=0 and carry 1 +1 01100111 +1 01101000
3
3
4
4 Positive and Negative Numbers Signed and unsigned numbers Unsigned: 2 8 =256 bit patterns represent 0 … 255 Signed: 2 8 bit patterns represent -128 … +127 Leftmost bit = sign bit: 0 => 0 or pos, 1 => neg Largest 8-bit positive number = 01111111 = 127 0 = 00000000 Most negative negative number = 10000000 =-128 Signed and unsigned numbers Unsigned: 2 8 =256 bit patterns represent 0 … 255 Signed: 2 8 bit patterns represent -128 … +127 Leftmost bit = sign bit: 0 => 0 or pos, 1 => neg Largest 8-bit positive number = 01111111 = 127 0 = 00000000 Most negative negative number = 10000000 =-128
5
5 Negative numbers +1 11111111 +1 00000000 -1 = 11111111 so addition works the same for positive and negative numbers
6
6 Biggest Numbers Biggest positive number = 01111111 (like 999999 on a car odometer) Most negative negative number = 10000000 Biggest positive number = 01111111 (like 999999 on a car odometer) Most negative negative number = 10000000
7
7 Biggest Positive Number + 1 “=” Most Negative Negative Number +1 01111111 +1 10000000
8
8 The Comair Christmas “Glitch” 16 bits for monthly count of crew changes Biggest positive 16-bit number =32,767 December was a bad month, lots of snowstorms, lots of flights rescheduled As Christmas approached the count went from 32,767 to -32,768 by adding 1 16 bits for monthly count of crew changes Biggest positive 16-bit number =32,767 December was a bad month, lots of snowstorms, lots of flights rescheduled As Christmas approached the count went from 32,767 to -32,768 by adding 1
9
9 Bytes 1 byte = 8 bits = 2 hex digits = 1 character 2 10 =1024 bytes = 1 kilobyte = 1KB 2 20 =1,048,576 bytes = 1 megabyte = 1MB 2 30 bytes = 1 gigabyte = 1GB = “a billion” 2 40 bytes = 1 terabyte = 1TB = “a trillion” 2 50 bytes = 1 petabyte = 1PB = “a quadrillion” 2 60 bytes = 1 exabyte = 1EB = a quintillion bytes 2 70 = zetta 2 80 = yotta 1 byte = 8 bits = 2 hex digits = 1 character 2 10 =1024 bytes = 1 kilobyte = 1KB 2 20 =1,048,576 bytes = 1 megabyte = 1MB 2 30 bytes = 1 gigabyte = 1GB = “a billion” 2 40 bytes = 1 terabyte = 1TB = “a trillion” 2 50 bytes = 1 petabyte = 1PB = “a quadrillion” 2 60 bytes = 1 exabyte = 1EB = a quintillion bytes 2 70 = zetta 2 80 = yotta
10
10 K K All this terminology based on the accident that Which is 1K? There are new standard names: 1 kibibyte = 1000 bytes vs. 1 kilobyte = 1024 bytes But almost no one uses “kibi-”, “mebi-”, etc. All this terminology based on the accident that Which is 1K? There are new standard names: 1 kibibyte = 1000 bytes vs. 1 kilobyte = 1024 bytes But almost no one uses “kibi-”, “mebi-”, etc.
11
11 http://www.ccc.de/congress/2004/fahrplan/files/316-hidden-data-slides.pdf
12
12
13
13
14
14
15
15
16
16
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.