EMB1006 The Binary System There is no 2 Jonathan-Lee Jones.

Slides:



Advertisements
Similar presentations
Intro to CS – Honors I Representing Numbers GEORGIOS PORTOKALIDIS
Advertisements

HEXADECIMAL NUMBERS Code
Addition and Subtraction. Outline Arithmetic Operations (Section 1.2) – Addition – Subtraction – Multiplication Complements (Section 1.5) – 1’s complement.
Principles of Computer Architecture Miles Murdocca and Vincent Heuring Chapter 2: Data Representation.
Integers. Integer Storage Since Binary consists only of 0s and 1s, we can’t use a negative sign ( - ) for integers. Instead, the Most Significant Bit.
Binary Addition Rules Adding Binary Numbers = = 1
CS 151 Digital Systems Design Lecture 3 More Number Systems.
Assembly Language and Computer Architecture Using C++ and Java
Level ISA3: Information Representation
Signed Numbers Up till now we've been concentrating on unsigned numbers. In real life we have to represent signed numbers ( like: -12, -45, 78). The difference.
Signed Numbers.
Assembly Language and Computer Architecture Using C++ and Java
Chapter 1.5 The Binary System CSCI 3. Basic Concepts Behind the Binary System In the decimal system, things are organized into columns – H | T | O – 1.
1 Binary Arithmetic, Subtraction The rules for binary arithmetic are: = 0, carry = = 1, carry = = 1, carry = = 0, carry =
CSCE 211: Digital Logic Design Chin-Tser Huang University of South Carolina.
Chapter Chapter Goals Know the different types of numbers Describe positional notation.
ENGIN112 L3: More Number Systems September 8, 2003 ENGIN 112 Intro to Electrical and Computer Engineering Lecture 3 More Number Systems.
Signed Numbers CS208. Signed Numbers Until now we've been concentrating on unsigned numbers. In real life we also need to be able represent signed numbers.
1 Binary Numbers Again Recall that N binary digits (N bits) can represent unsigned integers from 0 to 2 N bits = 0 to 15 8 bits = 0 to bits.
Binary, Decimal, & Hexadecimal Numbers
Data Representation in Computers. Data Representation in Computers/Session 3 / 2 of 33 Number systems  The additive approach – Number earlier consisted.
Chapter 3 Data Representation part2 Dr. Bernard Chen Ph.D. University of Central Arkansas Spring 2010.
Binary Representation and Computer Arithmetic
Dr. Bernard Chen Ph.D. University of Central Arkansas
Binary Representation - Shortcuts n Negation x + x = 1111…1111 two = -1 (in 2’s complement) Therefore, -x = x + 1 n Sign Extension o Positive numbers :
Binary Addition Addition Rules: = = = = = carry 1 1 carry 1 Example 1: Example 2:
The Binary Number System
Data Representation Number Systems.
Simple Data Type Representation and conversion of numbers
Numeral Systems Subjects: Numeral System Positional systems Decimal
CSCI-365 Computer Organization Lecture Note: Some slides and/or pictures in the following are adapted from: Computer Organization and Design, Patterson.
Chapter 7 Arithmetic Operations and Circuits Binary Arithmetic Addition –When the sum exceeds 1, carry a 1 over to the next-more-significant column.
BINARY ARITHMETIC Binary arithmetic is essential in all digital computers and in many other types of digital systems.
Number Systems Part 2 Numerical Overflow Right and Left Shifts Storage Methods Subtraction Ranges.
SIGNIFICANT FIGURES. Significant Figure Rules There are three rules on determining how many significant figures are in a number: Non-zero digits are always.
Computer Science 111 Fundamentals of Programming I Number Systems.
2-1 Chapter 2 - Data Representation Principles of Computer Architecture by M. Murdocca and V. Heuring © 1999 M. Murdocca and V. Heuring Principles of Computer.
Dale & Lewis Chapter 3 Data Representation. Data and computers Everything inside a computer is stored as patterns of 0s and 1s Numbers, text, audio, video,
CPS120: Introduction to Computer Science Computer Math: Signed Numbers.
Engineering 1040: Mechanisms & Electric Circuits Spring 2014 Number Systems.
Chapter 2 Binary Values and Number Systems. 2 2 Natural Numbers Zero and any number obtained by repeatedly adding one to it. Examples: 100, 0, 45645,
Computer Arithmetic and the Arithmetic Unit Lesson 2 - Ioan Despi.
Cosc 2150: Computer Organization Chapter 2 Part 1 Integers addition and subtraction.
Binary Values and Number Systems Chapter Goals Distinguish among categories of numbers Describe positional notation Convert numbers in other bases.
BR 8/99 Binary Numbers Again Recall than N binary digits (N bits) can represent unsigned integers from 0 to 2 N bits = 0 to 15 8 bits = 0 to 255.
CSC 221 Computer Organization and Assembly Language
ECE2030 Introduction to Computer Engineering Lecture 2: Number System Prof. Hsien-Hsin Sean Lee School of Electrical and Computer Engineering Georgia Tech.
Lecture 2 Binary Values and Number Systems. The number 943 is an example of a number written in positional notation. The relative positions of the digits.
Operations on Bits Arithmetic Operations Logic Operations
THE BINARY SYSTEM.
Computer Math CPS120 Introduction to Computer Science Lecture 4.
AEEE2031 Data Representation and Numbering Systems.
Number Systems & Operations
Addition and Substraction
WEEK #2 NUMBER SYSTEMS, OPERATION & CODES (PART 1)
Digital Representations ME 4611 Binary Representation Only two states (0 and 1) Easy to implement electronically %0= (0) 10 %1= (1) 10 %10= (2) 10 %11=
Bits, Data types, and Operations: Chapter 2 COMP 2610 Dr. James Money COMP
Introduction * Binary numbers are represented with a separate sign bit along with the magnitude. * For example, in an 8-bit binary number, the MSB is.
EEE342 Digital Electronics Ian McCrumRoom 5B18, Lecture 2: Codes & Arithmetic.
ECE DIGITAL LOGIC LECTURE 3: DIGITAL COMPUTER AND NUMBER SYSTEMS Assistant Prof. Fareena Saqib Florida Institute of Technology Fall 2016, 01/19/2016.
In decimal we are quite familiar with placing a “-” sign in front of a number to denote that it is negative The same is true for binary numbers a computer.
Computer Organization 1 Data Representation Negative Integers.
Bits, Data types, and Operations: Chapter 2 COMP 2610 Dr. James Money COMP
{ Binary “There are 10 types of people in the world: Those who understand binary, and those who don't.”
Computer Math CPS120 Introduction to Computer Science Lecture 7.
Binary Addition The simplest arithmetic operation in binary is addition. Adding two single-digit binary numbers is relatively simple, using a form of carrying:
Representing Positive and Negative Numbers
Unit 1 Introduction Number Systems and Conversion.
Unit 18: Computational Thinking
CPS120: Introduction to Computer Science
Presentation transcript:

EMB1006 The Binary System There is no 2 Jonathan-Lee Jones

Overview Basics 8bit unsigned Binary Addition Binary Multiplication Binary Division

The Basics We use a what is called base 10 for our number system. This includes the digits 0-9 and is very easy for us as most of us have 10 fingers to help count. Computers do not have 10 fingers, they use electric current, and so, as this can only be on or off, use binary. Binary has 2 digits, 0 and 1, and is also known as base 2.

The Basics Binary numbers are refered to by the number of digits, or ‘bits’ that make them up. Computers used to operate on 8 bits, then 16, 32 and now at 64bits (Or even in some cases 128bits) The number of bits gives the range (and accuracy) of numbers that can be dealt with, the amount of addresses that can be looked up, and more. In our examples we will look at 8 bit (as bigger would give me a headache!)

8bit Unsigned For any size binary number you work the range out by raising 2 to the power of the number of bits. 2 bits gives 2^2=4 4 bits gives 2^4=16 8 bits gives 2^8= bits 2^32=4,294,967,296

8bit Unsigned

8bit Unsigned

8bit Unsigned

8bit Unsigned

8bit Unsigned ERROR!!!

8bit Signed It is common to represent negative numbers in Binary by a few different methods.

8bit Signed Signed Magnitude:The simplest way to indicate negation is signed magnitude. In signed magnitude, the left-most bit is not actually part of the number, but is just the equivalent of a +/- sign. "0" indicates that the number is positive, "1" indicates negative. In 8 bits, would be 12 (break this down into (1*2^3) + (1*2^2) ). To indicate -12, we would simply put a "1" rather than a "0" as the first bit:

8bit Signed (Signed Magnitude)

8bit Signed (Signed Magnitude)

8bit Signed (Signed Magnitude)

8bit Signed (Signed Magnitude)

8bit Signed (Signed Magnitude)

8bit Signed (Signed Magnitude) ERROR!!! -128ERROR!!!

8bit Signed One's Complement: In one's complement, positive numbers are represented as usual in regular binary. However, negative numbers are represented differently. To negate a number, replace all zeros with ones, and ones with zeros - flip the bits. Thus, 12 would be , and -12 would be As in signed magnitude, the leftmost bit indicates the sign (1 is negative, 0 is positive). To compute the value of a negative number, flip the bits and translate as before.

8bit Signed (One’s Complement)

8bit Signed (One’s Complement) ERROR!!! -128ERROR!!!

8bit Signed Two's Complement: Begin with the number in one's complement. Add 1 if the number is negative. Twelve would be represented as , and -12 as To verify this, let's subtract 1 from , to get If we flip the bits, we get , or 12 in decimal.

8bit Signed (Signed Magnitude)

8bit Signed (Signed Magnitude)

8bit Signed (Signed Magnitude)

8bit Signed (Signed Magnitude)

8bit Signed (Signed Magnitude)

8bit Signed (Signed Magnitude) ERROR!!!

Binary Addition Consider the addition of decimal numbers: = We begin by adding 3+8=11. Since 11 is greater than 10, a one is put into the 10's column (carried), and a 1 is recorded in the one's column of the sum. Next, add {(2+4) +1} (the one is from the carry)=7, which is put in the 10's column of the sum. Thus, the answer is 71.

Binary Addition Binary addition works on the same principle, but the numerals are different. Begin with one-bit binary addition: 0+0=0; 0+1=1; 1+0=1 1+1 carries us into the next column. In decimal form, 1+1=2. In binary, any digit higher than 1 puts us a column to the left (as would 10 in decimal notation). The decimal number "2" is written in binary notation as "10" (1*2^1)+(0*2^0). Record the 0 in the ones column, and carry the 1 to the twos column to get an answer of "10."

Binary Addition The process is the same for multiple-bit binary numbers: = Step one: Column 2^0: 0+1=1. Record the 1. Temporary Result: 1; Carry: 0 Step two: Column 2^1: 1+1=10. Record the 0, carry the 1. Temporary Result: 01; Carry: 1 Step three: Column 2^2: 1+0=1 Add 1 from carry: 1+1=10. Record the 0, carry the 1. Temporary Result: 001; Carry: 1 Step four: Column 2^3: 1+1=10. Add 1 from carry: 10+1=11. Record the 11. Final result: 11001

Binary Addition Always remember 0+0=0 1+0=1 1+1=

Binary Addition Always remember 0+0=0 1+0=1 1+1=

Binary Multiplication Multiplication in the binary system works the same way as in the decimal system: 1*1=1 1*0=0 0*1=0 101 * *

Binary Division Follow the same rules as in decimal division. For the sake of simplicity, throw away the remainder. For Example: / r 10 _______ 11) ______ ______ ______ 10