Download presentation
Presentation is loading. Please wait.
Published byAllison McCormick Modified over 8 years ago
1
CS 104 Introduction to Computer Science and Graphics Problems Data Representation(1) Number Systems 09/12 ~ 09/16 /2008 Yang Song (Prepared by Yang Song and Suresh Solaimuthu)
2
Did you see this T-shirt before? There are 10 types of people; those who understand binary and those who don't.
3
What is Data? In computer science, data is any information in a form suitable for use with a computer. In an alternate usage, binary files (which are not human-readable) are sometimes called “data”, as distinguished from human-readable “text”.
4
Numerals and Number Systems Arabic Numerals: 1, 2, 3, …. Roman Numerals: I, II, III, …. Others? 一, 二, 三, …. Decimal System Uses ten digits 0 ~ 9 Base 10 4321 =? 4x10 3 + 3x10 2 + 2x10 1 + 1x10 0 Binary System Uses 2 digits 0, 1 Base 2
5
Some Units for Computer Bit: single Binary Digit - 1, 0. Nibble (Nybble): 4-bit aggregation - 1010 Byte (Octet): 8-bit aggregation - 1101 0010 Bigger ones? - KiloByte (KB): 2 10 (1,024) bytes - MegaByte (MB): 2 20 (1,048,576) bytes - GigaByte (GB): 2 30 (1,073,741,824) bytes
6
Decimal and Binary Computer “reads” binary Simple Only two symbols How can we convert them?
7
Binary Decimal The value of each position For Base 10, it is 10 0, 10 1, 10 2, 10 3 … etc. For Base 2, so, 2 0, 2 1, 2 2, 2 3 … etc. Convert binary 1011 2 into decimal: So it is: 8 + 2 + 1 = 11 Position Value8421 Binary1011 Actual8x14x02x11x1
8
Decimal Binary Division: Decimal number is the dividend, divisor is the “base”, so it’s 2 now, quotient becomes new dividend and save the remainder…until quotient < base, trace back from the last quotient to ALL the remainders. Decimal 11: so, it’s 1011 2 Dividend1152 Quotient521 Remainder110
9
Another example Convert 40 (decimal) into binary number: So it is: 101000 2 Can you convert decimal into base-7 number? Dividend40201052 Quotient2010521 Remainder00010
10
Octal Number Octal has 8 symbols: 0, 1, 2, 3….7 Base 8 Convert 1470 8 into decimal: 1x8 3 + 4x8 2 + 7x8 1 + 0x8 0 = 824 10 Convert back? Convert 1101010 2 into octal: Group them into 3 bits (why?) 1 101 010 1 5 2 8 Can you confirm this? Dividend82410312 Quotient103121 Remainder074
11
Hexadecimal Number Hexadecimal uses sixteen symbols: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, F Base 16 Range of a Byte: 00 ~ FF, why? Convert A2C into decimal 10x16 2 + 2x16 1 + 12x16 0 = 2604 10 Convert 2604 10 into Hexadecimal number? Convert 10100011111 2 into hexadecimal Group into 4 bits (why?) 101 0001 1111 51F 16 Confirm this one? Dividend2604162 Quotient162A(10) RemainderC(12)2
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.