28-Jun-15 Number Systems. 2 Bits and bytes A bit is a single two-valued quantity: yes or no, true or false, on or off, high or low, good or bad One bit.

Slides:



Advertisements
Similar presentations
CMSC 150 DATA REPRESENTATION CS 150: Mon 30 Jan 2012.
Advertisements

Data Representation COE 202 Digital Logic Design Dr. Aiman El-Maleh
18-May-15 Numbers. 2 Bits and bytes A bit is a single two-valued quantity: yes or no, true or false, on or off, high or low, good or bad One bit can distinguish.
James Tam Beyond Base 10: Non-decimal Based Number Systems What is the decimal based number system? How do other number systems work (binary, octal and.
James Tam Beyond Base 10: Non-decimal Based Number Systems What is the decimal based number system? How do other number systems work (binary, octal and.
James Tam Beyond Base 10: Non-decimal Based Number Systems What is the decimal based number system? How do other number systems work (binary, octal and.
Integer Types. Bits and bytes A bit is a single two-valued quantity: yes or no, true or false, on or off, high or low, good or bad One bit can distinguish.
Digital Fundamentals Floyd Chapter 2 Tenth Edition
Connecting with Computer Science, 2e
Binary and Hexadecimal Numbers
James Tam Beyond Base 10: Non-decimal Based Number Systems What is the decimal based number system? How do other number systems work (binary, octal and.
Data Representation in Computers
Binary Numbers.
CCE-EDUSAT SESSION FOR COMPUTER FUNDAMENTALS Date: Session III Topic: Number Systems Faculty: Anita Kanavalli Department of CSE M S Ramaiah.
COMPUTER FUNDAMENTALS David Samuel Bhatti
Numbering Systems Decimal (Denary) base 10. Clumsy when dealing with computers. Other systems –Binary –Octal –Hexadecimal Convenient when dealing with.
Real Numbers and the Decimal Number System
Number Systems and Codes
©Brooks/Cole, 2003 Chapter 2 Data Representation.
(2.1) Fundamentals  Terms for magnitudes – logarithms and logarithmic graphs  Digital representations – Binary numbers – Text – Analog information 
© 2009 Pearson Education, Upper Saddle River, NJ All Rights ReservedFloyd, Digital Fundamentals, 10 th ed Digital Fundamentals Tenth Edition Floyd.
Abstraction – Number Systems and Data Representation.
Binary Numbers and ASCII and EDCDIC Mrs. Cueni. Data Representation  Human speech is analog because it uses continuous signals (waves) that vary in strength.
Computers Organization & Assembly Language
Numeration Systems Introduction to Binary, Octal, and Hexadecimal.
1 Digital Systems and Binary Numbers EE 208 – Logic Design Chapter 1 Sohaib Majzoub.
Lec 3: Data Representation Computer Organization & Assembly Language Programming.
Chapter 7—Objects and Memory The Art and Science of An Introduction to Computer Science ERIC S. ROBERTS Java Objects and Memory C H A P T E R 7 Yea, from.
CCE-EDUSAT SESSION FOR COMPUTER FUNDAMENTALS Date: Session III Topic: Number Systems Faculty: Anita Kanavalli Department of CSE M S Ramaiah.
The Hexadecimal Number System and Memory Addressing ISAT 121.
1 Data Representation Characters, Integers and Real Numbers Binary Number System Octal Number System Hexadecimal Number System Powered by DeSiaMore.
Chapter 2 Number Systems: Decimal, Binary, and Hex.
Computer Science Binary. Binary Code Remember the power supply that is inside your computer and how it sends electricity to all of the components? That.
Data Representation Conversion 24/04/2017.
Binary01.ppt Decimal Decimal: Base 10 means 10 Unique numerical digits ,00010,000 Weight Positions 3,
Data Representation. What is data? Data is information that has been translated into a form that is more convenient to process As information take different.
Chapter 2 Binary Values and Number Systems Chapter Goals Distinguish among categories of numbers Describe positional notation Convert numbers in.
1 Digital Logic Design Engr. Kashif Shahzad. 2 What’s Course About?  Digital logic, focusing on the design of computers  Stay above transistor level.
Cis303a_chapt03_exam1_answer.ppt CIS303A: System Architecture Exam 1: Chapter 3 Answer List the characters (digits) for the following bases. 1) Decimal:
Number Systems. ASCII – American Standard Code for Information Interchange – Standard encoding scheme used to represent characters in binary format on.
09/06/ Data Representation ASCII, Binary Denary Conversion, Integer & Boolean data types.
Binary a. express numbers in binary, binary-coded decimal (BCD), octal and hexadecimal;
Number Systems. The position of each digit in a weighted number system is assigned a weight based on the base or radix of the system. The radix of decimal.
Some basic concepts underlying computer archi­tecture
Binary Representation in Text
Binary Representation in Text
Numbers Mar 27, 2013.
Lec 3: Data Representation
Binary Numbers and ASCII and EDCDIC
Number Representation
3.1 Denary, Binary and Hexadecimal Number Systems
BINARY CODE.
Data Encoding Characters.
Representing Nonnumeric Data
Ch2: Data Representation
Binary Lesson 3 Hexadecimal
Data Representation Conversion 05/12/2018.
COMS 161 Introduction to Computing
Binary Lesson 3 Hexadecimal
COMS 161 Introduction to Computing
Binary Lesson 3 Hexadecimal
Chapter Four Data Representation in Computers By Bezawit E.
Binary Lesson 4 Hexadecimal and Binary Practice
Abstraction – Number Systems and Data Representation
Numbers 27-Apr-19.
Beyond Base 10: Non-decimal Based Number Systems
Numbers 6-May-19.
Lecture 36 – Unit 6 – Under the Hood Binary Encoding – Part 2
Presentation transcript:

28-Jun-15 Number Systems

2 Bits and bytes A bit is a single two-valued quantity: yes or no, true or false, on or off, high or low, good or bad One bit can distinguish between two cases: T, F Two bits can distinguish between four cases: TT, TF, FT, FF Three bits can distinguish between eight cases: TTT, TTF, TFT, TFF, FTT, FTF, FFT, FFF In general, n bits can distinguish between 2 n cases A byte is 8 bits, therefore 2 8 = 256 cases

3 Number systems The binary (base 2) number system uses two “binary digits, ” (abbreviation: bits) -- 0 and 1 The octal (base 8) number system uses eight digits: 0, 1, 2, 3, 4, 5, 6, 7 The decimal (base 10) number system uses ten digits: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 The hexadecimal, or “hex” (base 16) number system uses sixteen digits: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, F

4 Everything is a number? Everything in the computer is stored as a pattern of bits Binary distinctions are easy for hardware to work with Numbers are stored as a pattern of bits Computers use the binary number system Characters are stored as a pattern of bits One byte (8 bits) can represent one of 256 characters So, is everything in the computer stored as a number? No it isn’t, it’s stored as a bit pattern There are many ways to interpret a bit pattern

5 Counting To count up in any number system, add 1 to the rightmost digit if the result is higher than the largest digit, set that digit to zero and carry to the next place repeat addition of 1 and carrying as many times as necessary Example: In hex, F is the largest digit Hence, 4A6FF + 1 = 4A700

6 Counting in three systems Dec Bin Hex A Dec Bin Hex B C D E F

7 Computers use binary numbers People like to use decimal numbers Computers use binary numbers Java translates decimal numbers into binary The computer does all its arithmetic in binary Java translates binary results back into decimal You occasionally have to use numbers in other number systems In Java, you can write numbers as octal, decimal, or hexadecimal (but not binary) Colors are usually specified in hexadecimal notation: #FF0000, #669966,

8 Using octal and hex numbers Computers use binary, but the numbers are too long and confusing for people--it’s easy to lose your place Octal or hex is better for people Translation between binary and octal or hex is easy One octal digit equals three binary digits One hexadecimal digit equals four binary digits B 5 C A 0 B

9 Writing octal and hex integers Integers are usually written in decimal notation: 7, 532, -28 To write a number in octal, just start with a zero: 02, 0657, but don’t use the digits 8 or 9 ! To write a number in hexadecimal, start with 0x or 0X : 0xA, 0X43AB5, -0xFFFF The “digits” A through F can be upper or lower case Uppercase is usually preferred Lowercase is more readable for long numbers

10 ASCII Up until recently, all programming languages used ASCII Source: Wikipedia

11 Extended ASCII In ASCII, the first bit is always zero Everybody got the bright idea of using a one for the first bit, to give an additional 128 characters Everybody added different characters, in different orders Lots of people who don't know any better put Extended ASCII characters (curly quotes, letters with accents marks, etc.) into their documents Consequently, other people see these characters as random garbage Moral: Don’t use Extended ASCII

12 Unicode Eventually, ASCII (American Standard Code for Information Interchange) wasn’t enough Unicode is the new standard; it has more than 100,000 characters defined For ease of transition, the first 128 characters are those defined in the ASCII standard, and require one byte each; other characters may require up to four bytes This is the UTF-8 encoding A second Unicode standard uses either two or four bytes for each character (again, the first 128 are the same as ASCII) This is the UTF-16 encoding Java and all other modern languages now use Unicode

13 The End “There are 10 kinds of people in the world: those who understand binary, and those who don’t.” --Anon. “Real Programmers always confuse Christmas and Halloween because Oct31 == Dec25” --Andrew Rutherford