Presentation is loading. Please wait.

Presentation is loading. Please wait.

CIS 234: Numbering Systems Dr. Ralph D. Westfall April, 2010.

Similar presentations


Presentation on theme: "CIS 234: Numbering Systems Dr. Ralph D. Westfall April, 2010."— Presentation transcript:

1 CIS 234: Numbering Systems Dr. Ralph D. Westfall April, 2010

2 Problem 1 computers only understand binary coded data (zeros and ones) 00000000, 11111111, 01010101 people like to count in decimals 00000000=0, 11111111=255, 01010101=85 1 st problem: it is extremely hard for people to work with binary data

3 Problem 2 (other Powerpoint)Powerpoint since computers only work with numbers, they need to use numbers to identify letters to print or show on screen e.g., 01000001=65=A people who don't read English also use computers 2 nd problem: what kind of numbering should be used for different languages?

4 Problem 1 Solution making binary easier to work with create numbering systems that are: compatible with binary numbers easier to read than binary

5 Numbering Systems all numbering systems have a "base" digit position = base raised to a power any number raised to power of zero = 1 decimal system is "base 10" 123 = 1 * 10^2 + 2 * 10^1 + 3 * 10^0 = 1 * 100 + 2 * 10 + 3 * 1 binary system is "base 2" 1010 = 1 * 2^3 + 0 * 2^2 + 1 * 2^1 + 0 * 2^0 = 1 * 8 + 0 * 4 + 1 * 2 + 0 * 1

6 Can Convert Between Bases converting binary to decimal 1111 = 1 * 2^3 + 1 * 2^2 + 1 * 2^1 + 1 * 2^0 15 = 1 * 8 + 1 * 4 + 1 * 2 + 1 * 1 binary/decimal conversion is awkward binary & decimal numbers don't match up well (sizes are inconsistent when convert between them) 7=111 (3 bits), 8=1000 (4 bits) 1001=9 (1 digit), 1010=10 (2 digits)

7 Hexadecimal Numbers (error)error hex means 6, decimal means 10 hexadecimal means base 16 first 9 digits of "hex" same as in decimal 0 is 0, 1 is 1 … 9 is 9 in either system 10 in decimal is a in hex 11=b, 12=c, 13=d, 14=e, 15=f in hex 16=10 in hex example: color codes in HTMLcolor codes in HTML

8 Conversions hex to decimal is easier than binary 2f = 2 * 16^1 + 15 * 16^0 = 47 3a = 3 * 16^1 + 10 * 16^0= 58 hex to binary is even easier one hex digit for every 4 bits f=1111, a=1010, 8=1000 2 hex digits = 1 byte ff=11111111=255 (Start>All Programs>Accessories>Calculator)Calculator (or Start>Run>calc>OK)

9 Octal Numbers octal means 8 octopus has 8 legs octal system uses base 8 has not caught on as much as hex 2 octal digits = 6 bits 3 octal digits = 9 bits 1 byte = 8 bits

10 Data Storage why is the range of the byte data type from –128 to + 127? 8 bits = 1 byte 00000000=0 01111111=127 10000000 =-128binary arithmeticbinary arithmetic 11111111=-1 ( =127 - 128) sign is in left bit (0=plus, 1=minus)

11 Numbering System Calculations 01 binary +01 =10 in binary 101 + 11 =1000 1 hexadecimal +9 = a in hex a +1 = b

12 Microsoft Calculator Does Hex Start>All Programs>Accessories> Calculator View>Scientific (or Start>Run>calc>OK) click Hex radio button and try calculating with hex #s (including A through F keys) click Bin and do binary calculations using only ones and zeros

13 Review Questions What two digits are used in computer hardware? What does binary mean? Give an example of a binary number What does hexadecimal mean? Give an example of a hexadecimal number Name some advantages of hex numbers over binary ones

14 Review Questions - 2 Convert 1010 into a decimal number Into a hexadecimal number Convert binary 11 to a decimal number What are the decimal values of the following hexadecimal numbers? 5 a f

15 Review Questions - 3 Add 10 plus 11 in binary Is 10000000 a positive or negative number in binary (on a PC)? What is the hexadecimal result of: adding 2 to a? adding 5 + 5 + 5? worksheet


Download ppt "CIS 234: Numbering Systems Dr. Ralph D. Westfall April, 2010."

Similar presentations


Ads by Google