Computer Number Systems

Similar documents
Counting in Different Number Systems

MATH Dr. Halimah Alshehri Dr. Halimah Alshehri

14:332:231 DIGITAL LOGIC DESIGN. Why Binary Number System?

Numbering Systems. Contents: Binary & Decimal. Converting From: B D, D B. Arithmetic operation on Binary.

We say that the base of the decimal number system is ten, represented by the symbol

ENGIN 112 Intro to Electrical and Computer Engineering

Week No. 06: Numbering Systems

CSEN102 Introduction to Computer Science

CHAPTER 2 NUMBER SYSTEMS

EE260: Digital Design, Spring n Digital Computers. n Number Systems. n Representations. n Conversions. n Arithmetic Operations.

EQ: How do I convert between standard form and scientific notation?

Chapter 1 CSCI

Conversions between Decimal and Binary

Menu. Review of Number Systems EEL3701 EEL3701. Math. Review of number systems >Binary math >Signed number systems

1 Computing System 2. 2 Data Representation Number Systems 22

E40M. Binary Numbers. M. Horowitz, J. Plummer, R. Howe 1

Binary addition example worked out

Number Theory: Representations of Integers

ECE380 Digital Logic. Positional representation

What are binary numbers and why do we use them? BINARY NUMBERS. Converting decimal numbers to binary numbers

12/31/2010. Digital Operations and Computations Course Notes. 01-Number Systems Text: Unit 1. Overview. What is a Digital System?

Number Systems. There are 10 kinds of people those that understand binary, those that don t, and those that expected this joke to be in base 2

ENGIN 112 Intro to Electrical and Computer Engineering

0,..., r 1 = digits in radix r number system, that is 0 d i r 1 where m i n 1

Chapter 2 (Part 3): The Fundamentals: Algorithms, the Integers & Matrices. Integers & Algorithms (2.5)

Four Important Number Systems

Unit 3. Digital encoding

UNIVERSITI TENAGA NASIONAL. College of Information Technology

A.0 SF s-uncertainty-accuracy-precision

Cs302 Quiz for MID TERM Exam Solved

hexadecimal-to-decimal conversion

ENG2410 Digital Design Introduction to Digital Systems. Fall 2017 S. Areibi School of Engineering University of Guelph

Self-Directed Course: Transitional Math Module 4: Algebra

2 ways to write the same number: 6,500: standard form 6.5 x 10 3 : scientific notation

Digital Electronics Part 1: Binary Logic

Scientific Notation. Scientific Notation. Table of Contents. Purpose of Scientific Notation. Can you match these BIG objects to their weights?

CISC 1400 Discrete Structures

NUMBERS AND CODES CHAPTER Numbers

13. [Place Value] units. The digit three places to the left of the decimal point is in the hundreds place. So 8 is in the hundreds column.

Number Bases. Ioan Despi. University of New England. August 4, 2013

Why digital? Overview. Number Systems. Binary to Decimal conversion

Chapter 5. Number Theory. 5.1 Base b representations

Introduction CSE 541

8th Grade Scientific Notation

8th Grade Scientific Notation

Binary addition (1-bit) P Q Y = P + Q Comments Carry = Carry = Carry = Carry = 1 P Q

Review for Test 1 : Ch1 5

TI-84+ GC 2: Exponents and Scientific Notation

Digital Systems Overview. Unit 1 Numbering Systems. Why Digital Systems? Levels of Design Abstraction. Dissecting Decimal Numbers

Topic 1: Digital Data

Park Forest Math Team. Meet #3. Number Theory. Self-study Packet

Digital Systems Roberto Muscedere Images 2013 Pearson Education Inc. 1

THE LOGIC OF COMPOUND STATEMENTS

Simple Interactions CS 105 Lecture 2 Jan 26. Matthew Stone

CSE 20 DISCRETE MATH. Winter

ECE260: Fundamentals of Computer Engineering

2x + 5 = x = x = 4

6-3 Solving Systems by Elimination

Trinity Web Site Design. Today we will learn about the technology of numbering systems.

Informatics 1 - Computation & Logic: Tutorial 3

Systems I: Computer Organization and Architecture

CSE 1400 Applied Discrete Mathematics Definitions

Section 3-4: Least Common Multiple and Greatest Common Factor

Complement Arithmetic

CHEM Chapter 1

Computer Organization I Test 1/Version 1 CMSC 2833 Autumn 2007

The trick is to multiply the numerator and denominator of the big fraction by the least common denominator of every little fraction.

Design of Digital Circuits Reading: Binary Numbers. Required Reading for Week February 2017 Spring 2017

Please bring the task to your first physics lesson and hand it to the teacher.

How long is the arrow?

CHAPTER 5 A BLOCK CIPHER INVOLVING A KEY APPLIED ON BOTH THE SIDES OF THE PLAINTEXT

of Digital Electronics

Combinational Logic. By : Ali Mustafa

10/14/2009. Reading: Hambley Chapters

Exponential and logarithm functions

Investigating Inequalities:

ALGEBRA+NUMBER THEORY +COMBINATORICS

Unit II Chapter 4:- Digital Logic Contents 4.1 Introduction... 4

CSE 20 DISCRETE MATH. Fall

2-7 Solving Absolute-Value Inequalities

Scientific Notation. Chemistry Honors

B. Converting Numbers in Base ten to other bases Example

Solving Equations with Addition and Subtraction

Contents. Chapter 2 Digital Circuits Page 1 of 30

Problem Points Score Total 100

26. FOIL AND MORE. 1 2t + 3xy 5x 2 = 1 + ( 2t) + 3xy + ( 5x 2 )

NUMBER SYSTEMS. and DATA REPRESENTATION. for COMPUTERS (PROBLEM ANSWERS)

December 04, scientific notation present.notebook

Carry Look Ahead Adders

CSE 241 Digital Systems Spring 2013

Number System. Decimal to binary Binary to Decimal Binary to octal Binary to hexadecimal Hexadecimal to binary Octal to binary

Indices Learning Outcomes

CS1800 Discrete Structures Fall 2017 October, CS1800 Discrete Structures Midterm Version A

56 CHAPTER 3. POLYNOMIAL FUNCTIONS

Name: Block: Unit 2 Inequalities

3.5 Solving Equations Involving Integers II

Next, we include the several conversion from type to type.

CPE100: Digital Logic Design I

CSE 20: Discrete Mathematics

Chapter 2 Linear Equations and Inequalities in One Variable

Transcription:

Computer Number Systems All computers are electronic devices and can ultimately do one thing: detect whether an electrical signal is on or off. Therefore, the earliest computer scientists realized that the binary number system which is base 2 and has only the digits 0 and 1 was better to use than the decimal number system which is base 10 and has digits 0, 1, 2,, 9. They called each binary digit a bit and used them to represent ON or TRUE with a 1 and OFF or FALSE with a 0. Octal and Hexadecimal Numbers Because binary numbers could get very long even for small decimal numbers, they grouped 3 binary digits together to form one base 8 digit and called that octal and grouped 4 binary digits together to form one base 16 digit and called that hexadecimal. The following table shows equivalent values in these bases: Three digits (0 for left-most) Four digits (needed for base 16) 0000 = 0 1000 = 8 0001 = 1 1001 = 9 0010 = 2 1010 = A (10) 0011 = 3 1011 = B (11) 0100 = 4 1100 = C (12) 0101 = 5 1101 = D (13) 0110 = 6 1110 = E (14) 0111 = 7 1111 = F (15) As you can see, the largest value that can be represented with 3 binary digits (when the first digit is a 0) is 7 and the largest value with 4 bits is 15. However, because all digits must be single characters, the letters A F are used to represent the values 10 to 15. Therefore, in base 8, the digits must be 0 to 7 and in base 16 the digits must be 0 9, A F. Grouping Binary Digits for Octal and Hexadecimal Numbers An easy way to convert between bases 2, 8, and 16 is by grouping bits together and using the table above. 1001010110 2 = 001 001 010 110 2 = 1126 8 and 1001010110 2 = 0010 0101 0110 2 = 256 16 Notice that grouping is always done starting with the last digit. Here are two other examples:

A) Write 1010111011110101 2 in octal: Divide the binary number into groups of 3 from right to left. Convert each grouping to its octal value. 001 010 111 011 110 101 2 = 1 2 7 3 6 5 8 B) Write 1010111011110101 2 in hexadecimal: Divide the binary number into groups of 4 from right to left. Convert each grouping to its hexadecimal value. 1010 1110 1111 0101 2 = A E F 5 16. Using Expanded Notation to Find Base 10 Values In addition, expanded notation in the decimal number system can represent different numbers by using powers of 10: 4,381 = 4 x 1000 + 3 x 100 + 8 x 10 + 1 = 4 x 10 3 + 3 x 10 2 + 8 x 10 1 + 1 x 10 0 50,070 = 5 x 10 4 + 0 x 10 3 + 0 x 10 2 + 7 x 10 1 + 0 x 10 1 = 50000 + 70 Remember that any non-zero number raised to the 0 power equals 1 and 0 multiplied by anything is 0.. All other bases work the same way as follows: 1101 2 = 1 x 2 3 + 1 x 2 2 + 0 x 2 1 + 1 x 2 0 = 8 + 4 + 0 + 1 = 13 10 (Compare this value with the above table.) 175 8 = 1 x 8 2 + 7 x 8 1 + 5 x 8 0 = 1 x 64 + 7 x 8 + 5 x 1 = 64 + 56 + 5 = 125 10. A5E 16 = 10 x 16 2 + 5 x 16 1 + 14 x 16 0 = 10 x 256 + 5 x 16 + 14 x 1 = 2560 + 80 + 14 = 2654 10. Using Hexadecimal Numbers to Represent Colors Computers use hexadecimal numbers to represent various colors in computer graphics because all computer screens use combinations of red, green, and blue light or RGB to represent thousands of different colors.

Two digits are used for each so the hexadecimal number #FF0000 represents the color red, #00FF00 represents green, and #0000FF represents blue. The color black is #000000 and white is #FFFFFF. The hash tag or number sign is used to denote a hexadecimal number. FF 16 = F (15) x 16 + F (15) x 1 = 240 + 15 = 255 10 so there are 0 to 255 or 256 different shades of each color or 256 3 = 16,777,216 different colors. The following web site has every color name, decimal value, and hexadecimal value: https://web.njit.edu/~kevin/rgb.txt.html. For example salmon is #FA8072 which represents the decimal numbers 250, 128, 114. Adding and Subtracting in Other Bases When adding numbers in base 10, you have learned to carry a 1 to the next place when the answer is 10 or more and keep the value that is more than 10. For example, 15 + 48 = 63 because 5+8 = 13 so you keep the 3 and carry the 1. When subtracting numbers, you have learned to borrow a 1 from the next place and add 10 to the current digit. For example, 75-48 The same rules can be used in any base by using the number of the base instead of 10. Some simple examples are: 0 2 + 0 2 = 0 2 0 2 + 1 2 = 1 2 1 2 + 1 2 = 10 2 7 8 + 1 8 = 10 8 F 16 + 1 16 = 10 16 FF 16 + 1 16 = 100 16 Other examples in base 8 and 16 are: A) 645 8 B) A6B5 16 C) 645 8 D) A6B5 16 + 372 8 + 4C1F 16-372 8-4C1F 16 -------- ----------- -------- ----------- 1237 8 F2D4 16 253 8 5A96 16 Remember that every letter in base 16 must be changed to its equivalent value first. In problem B, 5 + F (15) = 20 so keep 20 16 = 4 and carry a 1 so A (10) + 4 + 1 = 15 (F). In problem D, borrow 16 from the B and make it an A (10). Then, 16 + 5 = 21 F (15) = 6. The same concept is used in octal by carrying or borrowing 8. References http://csunplugged.org/binary-numbers/ http://www.mathmaniacs.org/lessons/01-binary/

https://educators.brainpop.com/bp-topic/binary/ https://en.wikipedia.org/wiki/rgb_color_model Sample Problems 11101001011 2 in base 16? By grouping digits, the binary number 11101001011 2 = 0111 0100 1011 2 = 74B 16. 1ACE 16 + 456 16 in hexadecimal? Using the method shown above, E (14) + 6 = 20 so carry the 1 and keep the 4. C (12) + 5 + 1 = 18 so carry the 1 and keep the 2. A (10) + 4 + 1 = 15 which is F so there is nothing to carry. The answer is 1F24 16. 135 8 in base 10? 135 8 = 1 x 8 2 + 3 x 8 1 + 5 x 8 0 = 64 + 24 + 5 = 93 10. 1101011 2 in base 10? By using expanded notation starting on the right, the value is 1 x 2 0 + 1 x 2 1 + 0 x 2 2 + 1 x 2 3 + 0 x 2 4 + 1 x 2 5 + 1 x 2 6 = 1 + 2 + 8 + 32 + 64 = 107 10. How many 1s are in the binary representation of 4327 8? 4327 8 = 100 011 010 111 2 so there are 7 bits that are 1s and 5 bits that are 0s. On the RGB color table, the color sky blue is the hexadecimal number #38B0DE. What is the decimal value for the blue component? The RED component is 38, the GREEN component is B0, and the BLUE component is DE. Therefore, DE 16 = 13 x 16 + 14 x 1 = 208 + 14 = 222 10. 1CE2 16-9F6 16 in hexadecimal? For the last two digits, you can t subtract 2 from 6 so borrow and make E a D. You can t subtract F from D so borrow and make C a B. Borrow 16 in each case. Then 2 + 16-6

= 12(C). D(13) + 16 - F(15) = 14(E). B(11) - 9 = 2. The answer is 12EC 16. Which of the following is the largest number? a) AB 16 b) 10101100 2 c) 251 8 AB 16 = 10101011 2 = 10*16+11 = 171 10 10101100 2 = 4 + 8 + 32 + 128 = 172 10 251 8 = 10101101 2 = 2*64+5*8+1 = 169 10 Either way, the largest number is (b). What is the average of the following three numbers in base 10? 10011 2, 21 8,1E 16 10011 2 = 1*1 + 1*2 + 0*4 + 0*8 + 1*16 = 19 21 8,= 2*8 + 1 = 17 1E 16 = 1*16 + 14 = 30 (19 + 17 + 30) / 3 = 66 / 3 = 22 10 Which of the following numbers has the least number of 1 s in their binary representation? A) BAD 16 B) FED 16 C) CAB 16 D) ACE 16 BAD 16 = 1011 1010 1101 2 which is 8 bits. FED 16 = 1111 1110 1101 2 which is 10 bits. CAB 16 = 1100 1010 1011 2 which is 7 bits. ADE 16 = 1010 1101 1110 2 which is 8 bits. Therefore, the answer is letter (C).