CIS 234: Numbering Systems Dr. Ralph D. Westfall April, 2010
Problem 1 computers only understand binary coded data (zeros and ones) , , people like to count in decimals =0, =255, =85 1 st problem: it is extremely hard for people to work with binary data
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., =65=A people who don't read English also use computers 2 nd problem: what kind of numbering should be used for different languages?
Problem 1 Solution making binary easier to work with create numbering systems that are: compatible with binary numbers easier to read than binary
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 * * * 1 binary system is "base 2" 1010 = 1 * 2^3 + 0 * 2^2 + 1 * 2^1 + 0 * 2^0 = 1 * * * * 1
Can Convert Between Bases converting binary to decimal 1111 = 1 * 2^3 + 1 * 2^2 + 1 * 2^1 + 1 * 2^0 15 = 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)
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
Conversions hex to decimal is easier than binary 2f = 2 * 16^ * 16^0 = 47 3a = 3 * 16^ * 16^0= 58 hex to binary is even easier one hex digit for every 4 bits f=1111, a=1010, 8= hex digits = 1 byte ff= =255 (Start>All Programs>Accessories>Calculator)Calculator (or Start>Run>calc>OK)
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
Data Storage why is the range of the byte data type from –128 to + 127? 8 bits = 1 byte = = =-128binary arithmeticbinary arithmetic =-1 ( = ) sign is in left bit (0=plus, 1=minus)
Numbering System Calculations 01 binary +01 =10 in binary = hexadecimal +9 = a in hex a +1 = b
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
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
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
Review Questions - 3 Add 10 plus 11 in binary Is a positive or negative number in binary (on a PC)? What is the hexadecimal result of: adding 2 to a? adding ? worksheet