LSP 121 The Power of Numbers Conversions Convert
LSP 121 The Power of Numbers
Conversions • Convert 23 feet to inches – We all know there are 12 inches to a foot, so 12 * 23 = 276 inches – But what did we really do? 23 feet x 12 inches 1 foot
Conversions • At a French department store, the price for a pair of Levi jeans is 45 euros. What is that in U. S. dollars? $1. 37 45 euros x 1 euro = $61. 65
Chain of Conversion • How many seconds in one day? 1 day x 24 hours 1 day x 60 min 1 hour x 60 sec 1 min = 86, 400 sec • You want to carpet your bedroom. It is 23 feet x 18 feet. How many square yards is that? 23 ft x 18 ft = 414 ft 2 x 1 yd 2 9 ft 2 = 46 yd 2
Chain of Conversion • To connect a computer to the Internet, the computer needs an IP address. Currently IP addresses are 32 bits in length. How many addresses is that? IP addresses are binary, so raise 2 to the 32 nd power Or 232 = 4, 294, 967, 296 • If they assign 1000 addresses a day, how long would those addresses last (in years)?
Chain of Conversion 232 addresses x 1 day/1000 addresses = 4, 294, 967. 296 days * 1 year/365 days = 11767. 03 years Be careful! Don’t do: 232 addresses x 1000 addresses/1 day The term addresses won’t cancel!
Standardized Units • In the U. S. , we still use: Lengths Inch Foot Yard Rod (5. 5 yards) Fathom (6 feet) Furlong (1/8 mile) Mile Nautical mile (6076. 1 feet) Weights Grain (0. 0648 gram) Ounce Pound Ton Long ton (2240 pounds) Liquid measures Teaspoon Tablespoon (3 t) Fluid ounce (2 T) Cup (8 fluid ounces) Pint (16 fluid ounces) Quart (2 pints) Gallon (4 quarts) Barrel of petroleum (42 gals) Dry measures Dry pint Dry quart Peck (8 dry quarts) Bushel (4 pecks) Cord (128 cubic feet) Classic College of Engineering “expression”: Units of measure will always be stated in least likely terms. Example: Furlongs per fortnight.
Standardized Units • Most of the rest of the world uses the metric system: Small Values meter – length gram – mass second – time liter - volume Large Values deca da hecto h kilo k mega M giga G tera T deci centi milli micro nano pico d c m µ n p 10 -1 one-tenth 10 -2 one-hundredth 10 -3 one-thousandth 10 -6 one-millionth 10 -9 one-billionth 10 -12 one-trillionth Note: 2. 3 E+06 = 2. 3 x 106 4. 6 E-04 = 0. 00046 101 (ten) 102 (hundred) 103 (thousand) (such as 200 kbps transfer speed) 106 (million) 109 (billion) 1012 (trillion) unless………………. .
Standardized Units? What about computer memory? Note: memory is based on binary so we use base 2 K = kilo (kilobytes) = 210 = 1024 M = mega (megabytes) = 220 = 1, 048, 576 G = giga (gigabytes) = 230 = 1, 073, 741, 824 T = tera (terabytes) = 240 = 1, 099, 511, 627, 776 followed by peta, exa, zetta, yotta • Some groups suggested we should call these kibi, mebi, gibi, tebi, pebi, exbi (and yes, zebi and yobi)
Binary Numbers • Why should anyone learn binary? • All music, video, data, and computer programs are stored in computer memory/storage • Computers are based on the binary number system (on/off or 1/0) • If your i. Pod / computer / flash drive has x storage capacity, what does that mean?
Binary Numbers • Before we discuss binary arithmetic, do you really understand decimal arithmetic? 1024 = 1 x 103 + 0 x 102 + 2 x 101 + 4 x 100 • Binary numbers are the same, except there are only 2 digits (0 and 1), and the base is 2 10010 = 1 x 24 + 0 x 23 + 0 x 22 + 1 x 21 + 0 x 20
Binary Numbers • Let’s play a game. You are a cashier at your favorite store. How do you make $0. 86 in change? • What if you only have dimes, nickels and pennies? • A good cashier always tries to use the biggest coins possible.
Binary Numbers • You are now working in a foreign country. They don’t have quarters, dimes, or nickels; they have 16 cent pieces, 8 cent pieces, 4 cent pieces, 2 cent pieces, and pennies, and you can only give out at most one of each coin! • How do you make change for $0. 14? $0. 29? • Let’s list these coins in order from highest on the left to lowest on the right.
Binary Numbers • What is the decimal value of binary 10010101? • What is the binary value of decimal 83? • Use a calculator?
Binary Arithmetic • Let’s add the following two binary values 10011100 01011010 • When a computer does arithmetic, it converts all values to binary. • This takes a little bit of time, which is why we say “if you aren’t doing arithmetic with the data, don’t declare it as type numeric”
Binary Representation When you type the letter “n” on the keyboard, it converts it to an 8 -bit binary value, based on the ASCII character set. So all Word documents are stored sequences of 8 bit ASCII characters (called bytes) All color images are composed of teeny-tiny dots (pixels). Each pixel is composed of so much red, so much green, and so much blue (RGB)
Binary Representation Music on i. Pods and such are stored in binary Music is an analog waveform the waveform is sampled at regular intervals each sample is converted to a binary value (such as 8 -bits) the binary values are stored in memory Talking on a cellphone/telephone is also binary all voice is converted to binary in the same way that music is converted to binary
Binary Representation So pretty much everything we do technology-wise is binary Computer work Music Television Photography/video Telephones/cellphones Is there any major at De. Paul that does not use computers or binary numbers?
- Slides: 18