# Binary Representation. Number Systems. Base 10, Base 2, Base 16. Positional Notation. Conversion of Any Base to Decimal.

Save this PDF as:

Size: px
Start display at page:

Download "Binary Representation. Number Systems. Base 10, Base 2, Base 16. Positional Notation. Conversion of Any Base to Decimal."

## Transcription

1 Binary Representation The basis of all digital data is binary representation. Binary - means two 1, 0 True, False Hot, Cold On, Off We must be able to handle more than just values for real world problems 1, 0, 56 True, False, Maybe Hot, Cold, LukeWarm, Cool On, Off, Leaky V Number Systems To talk about binary data, we must first talk about number systems The decimal number system (base 10) you should be familiar with! A digit in base 10 ranges from 0 to 9. A digit in base 2 ranges from 0 to 1 (binary number system). A digit in base 2 is also called a bit. A digit in base R can range from 0 to R-1 A digit in Base 16 can range from 0 to 16-1 (0,1,2,3,4,5,5,6,7,8,9,A,B,C,D,E,F). Use letters A-F to represent values 10 to 15. Base 16 is also called Hexadecimal or just Hex. V Positional Notation Value of number is determined by multiplying each digit by a weight and then summing. The weight of each digit is a POWER of the BASE and is determined by position = 9 x x x x x 10-2 = = % = 1x x x x x x2-2 = = \$ A2F = 10x x x16 0 = 10 x x x 1 = = 2607 V Base 10, Base 2, Base 16 The textbook uses subscripts to represent different bases (ie. A2F 16, , ) I will use special symbols to represent the different bases. The default base will be decimal, no special symbol for base 10. The \$ will be used for base 16 ( \$A2F) Will also use h at end of number (A2Fh) The % will be used for base 2 (% ) If ALL numbers on a page are the same base (ie, all in base 16 or base 2 or whatever) then no symbols will be used and a statement will be present that will state the base (ie, all numbers on this page are in base 16). V Common Powers Conversion of Any Base to Decimal 2-3 = = = = = = = = = = = = = = = = = 1 = = 16 = = 256 = = 4096 = = 1024 = 1 K 2 20 = = 1 M (1 Megabits) = 1024 K = 2 10 x = = 1 G (1 Gigabits) V Converting from ANY base to decimal is done by multiplying each digit by its weight and summing. Binary to Decimal % = 1x x x x x x2-2 = = Hex to Decimal A2Fh = 10x x x16 0 = 10 x x x 1 = = 2607 V

2 Conversion of Decimal Integer To ANY Base Divide Number N by base R until quotient is 0. Remainder at EACH step is a digit in base R, from Least Significant digit to Most significant digit. Convert 53 to binary 53/2 = 26, rem = 1 Least Significant Digit 26/2 = 13, rem = 0 13/2 = 6, rem = 1 6 /2 = 3, rem = 0 3/2 = 1, rem = 1 1/2 = 0, rem = 1 Most Significant Digit 53 = % = 1x x x x x x2 0 = = 53 V Least Significant Digit Most Significant Digit 53 = % Most Significant Digit (has weight of 2 5 or 32). For base 2, also called Most Significant Bit (MSB). Always LEFTMOST digit. Least Significant Digit (has weight of 2 0 or 1). For base 2, also called Least Significant Bit (LSB). Always RIGHTMOST digit. V More Conversions Convert 53 to Hex 53/16 = 3, rem = 5 3 /16 = 0, rem = 3 53 = 35h = 3 x x 16 0 = = 53 V Hex (base 16) to Binary Conversion Each Hex digit represents 4 bits. To convert a Hex number to Binary, simply convert each Hex digit to its four bit value. Hex Digits to binary: \$ 0 = % 0000 \$ 1 = % 0001 \$2 = % 0010 \$3 = % 0011 \$4 = % 0100 \$5 = % 0101 \$6 = % 0110 \$7 = % 0111 \$8 = % 1000 Hex Digits to binary (cont): \$ 9 = % 1001 \$ A = % 1010 \$ B = % 1011 \$ C = % 1100 \$ D = % 1101 \$ E = % 1110 \$ F = % 1111 V Hex to Binary, Binary to Hex A2Fh = % h = % Binary to Hex is just the opposite, create groups of 4 bits starting with least significant bits. If last group does not have 4 bits, then pad with zeros for unsigned numbers. % = % = 51h Padded with a zero V A Trick! If faced with a large binary number that has to be converted to decimal, I first convert the binary number to HEX, then convert the HEX to decimal. Less work! % = % = D F 3 = 13 x x x16 0 = 13 x x x 1 = = 3571 Of course, you can also use the binary, hex conversion feature on your calculator. Too bad calculators won t be allowed on the first test, though... V

3 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 bits = 0 to Besides simply representation, we would like to also do arithmetic operations on numbers in binary form. Principle operations are addition and subtraction. V Binary Arithmetic, Subtraction The rules for binary arithmetic are: = 0, carry = = 1, carry = = 1, carry = = 0, carry = 1 The rules for binary subtraction are: 0-0 = 0, borrow = = 1, borrow = = 1, borrow = = 0, borrow = 0 Borrows, Carries from digits to left of current of digit. Binary subtraction, addition works just the same as decimal addition, subtraction. V Decimal Binary, Decimal addition from LSD to MSD: 7+4 = 1; with carry out of 1 to next column 1 (carry) = 5. answer = 51. Binary % % From LSB to MSB: 1+1 = 0, carry of 1 1 (carry)+1+0 = 0, carry of 1 1 (carry) = 1, no carry 1 +0 = = = 1 answer = % V Decimal = 9; with borrow of 1 from next column 0-1 (borrow) - 0 = 9, with borrow of (borrow) - 0 = 8. Answer = 899. Subtraction Binary % % = 1; with borrow of 1 from next column 0-1 (borrow) - 0 = 1, with borrow of (borrow) - 0 = 0. Answer = % 011. V Ah + 28h h A+8 = 2; with carry out of 1 to next column 1 (carry) = 6. answer = \$ 62. Hex Addition Decimal check. 3Ah = 3 x = 58 28h = 2 x = = 98 62h = 6 x = = 98!! V Hex addition again Why is Ah + 8h = 2 with a carry out of 1? The carry out has a weight equal to the BASE (in this case 16). The digit that gets left is the excess (BASE - sum). Ah + 8h = = is GREATER than 16 (BASE), so need a carry out! Excess is 18 - BASE = = 2, so 2 is digit. Exactly the same thing happens in Decimal = 2, carry of = 12, this is greater than 10!. So excess is = 2, carry of 1. V

4 34h - 27h Dh 4-7 = D; with borrow of 1 from next column 3-1 (borrow) - 2 = 0. answer = \$ 0D. Hex Subtraction Decimal check. 34h = 3 x = 52 27h = 2 x = = 13 0Dh = 13!! Hex subtraction again Why is 4h 7h = \$D with a borrow of 1? The borrow has a weight equal to the BASE (in this case 16). BORROW +4h 7h = = 20-7 = 13 = Dh. Dh is the result of the subtraction with the borrow. Exactly the same thing happens in decimal. 3-8 = 5 with borrow of 1 borrow = = 13-8 = 5. V V Fixed Precision With paper and pencil, I can write a number with as many digits as I want: 1,027,80,032,034,532,002,391,030,300,209,399,302,992,092,920 A microprocessor or computing system usually uses FIXED PRECISION for integers; they limit the numbers to a fixed number of bits: \$ AF DEFA bit number, 16 hex digits \$ 9DEFA bit number, 8 hex digits \$ A bit number, 4 hex digits \$ 31 8 bit number, 2 hex digits High end microprocessors use 64 or 32 bit precision; low end microprocessors use 16 or 8 bit precision. V Unsigned Overflow In this class I will use 8 bit precision most of the time, 16 bit occassionally. Overflow occurs when I add or subtract two numbers, and the correct result is a number that is outside of the range of allowable numbers for that precision. I can have both unsigned and signed overflow (more on signed numbers later) 8 bits -- unsigned integers 0 to or 0 to bits -- unsigned integers 0 to or 0 to V Unsigned Overflow Example Assume 8 bit precision; ie. I can t store any more than 8 bits for each number. Lets add = 256. The number 256 is OUTSIDE the range of 0 to 255! What happens during the addition? 255 = \$ FF /= means Not Equal + 1 = \$ /= \$00 \$F + 1 = 0, carry out \$F + 1 (carry) + 0 = 0, carry out Carry out of MSB falls off end, No place to put it!!! Final answer is WRONG because could not store carry out. V Unsigned Overflow A carry out of the Most Significant Digit (MSD) or Most Significant Bit (MSB) is an OVERFLOW indicator for addition of UNSIGNED numbers. The correct result has overflowed the number range for that precision, and thus the result is incorrect. If we could STORE the carry out of the MSD, then the answer would be correct. But we are assuming it is discarded because of fixed precision, so the bits we have left are the incorrect answer. V

5 Signed Integer Representation We have been ignoring large sets of numbers so far; ie. the sets of signed integers, fractional numbers, and floating point numbers. We will not talk about fractional number representation ( ) or floating point representation (i.e x ). We WILL talk about signed integer representation. The PROBLEM with signed integers ( - 45, + 27, -99) is the SIGN! How do we encode the sign? The sign is an extra piece of information that has to be encoded in addition to the magnitude. Hmmmmm, what can we do?? V Twos Complement Examples -5 = % = \$ FB +5 = % = \$ = % = \$ 7F -127 = % = \$ = % = \$80 (note the extended range!) + 0 = % = \$ 00-0 = % = \$ 00 (only 1 zero!!!) For 8 bits, can represent the signed integers -128 to For N bits, can represent the signed integers -2 (N-1) to + 2 (N-1) -1 Note that negative range extends one more than positive range. V Twos Complement Comments Twos complement is the method of choice for representing signed integers. There is only one zero, and K + (-K) = = \$ FB + \$ 05 = \$00 = 0!!! Normal binary addition is used for adding numbers that represent twos complement integers. V A common Question from Students A question I get asked by students all the time is : Given a hex number, how do I know if it is in 2 s complement or 1 s complement; is it already in 2 s complement or do I have put it in 2 s complement, etc, yadda,yadda, yadda. If I write a HEX number, I will ask for a decimal representation if you INTERPRET the encoding as a particular method (i.e, either 2 s complement, 1 s complement, signed magnitude). A Hex or binary number BY ITSELF can represent ANYTHING (unsigned number, signed number, character code, colored llamas, etc). You MUST HAVE additional information that tells you what the encoding of the bits mean. V Example Conversions \$FE as an 8 bit unsigned integer = 254 \$FE as an 8 bit twos complement integer = -2 \$7F as an 8 bit unsigned integer = 127 \$7f as an 8 bit twos complement integer = +127 To do hex to signed decimal conversion, we need to determine sign (Step 1), determine Magnitude (step 2), combine sign and magnitude (Step 3) Hex to Signed Decimal Conversion Rules Given a Hex number, and you are told to convert to a signed integer (Hex number uses 2s complement encoding) STEP 1: Determine the sign! If the Most Significant Bit is zero, the sign is positive. If the MSB is one, the sign is negative. \$F0 = % (MSB is 1 ), so sign of result is - \$64 = % (MSB is 0 ), so sign of result is +. If the Most Significant Hex Digit is > 7, then MSB = 1!!! (eg, \$8,9,A,B,C,D,E,F => MSB = 1!!!) V V

6 Hex to Signed Decimal (cont) STEP 2 (positive sign): If the sign is POSITIVE, then just convert the hex value to decimal. \$64 is a positive number, decimal value is 6 x = 100. Final answer is \$64 as an 8 bit twos complement integer = +100 Hex to Signed Decimal (cont) STEP 2 (negative sign): If the sign is Negative, then need to compute the magnitude of the number. We will use the trick that - (-N) = + N i.e. Take the negative of a negative number will give you the positive number. In this case the number will be the magnitude. For 2s complement representation, complement and add one. \$F0 = % => % = % = \$10 = 16 V V Hex to Signed Decimal (cont) STEP 3 : Just combine the sign and magnitude to get the result. \$F0 as 8 bit twos complement number is -16 \$64 as an 8 bit twos complement integer = +100 Signed Decimal to Hex conversion 2 s complement Step 1: Ignore the sign, convert the magnitude of the number to binary. 34 = 2 x = \$ 22 = % = 1 x = \$ 14 = % Step 2 (positive decimal number): If the decimal number was positive, then you are finished! +34 as an 8 bit 2s complement number is \$ 22 = % V V Signed Decimal to Hex conversion (cont) Step 2 (negative decimal number): Need to do more if decimal number was negative. To get the final representation, we will use the trick that: -(+N) = -N i.e., if you take the negative of a positive number, get Negative number. For 2s complement, complement and add one. 20 = % => % = % = \$EC Signed Decimal to Hex conversion (cont) Final results: +34 as an 8 bit 2s complement number is \$ 22 = % as an 8 bit 2s complement number is \$ EC = % V V

7 Two s Complement Overflow Consider two 8-bit 2 s complement numbers. I can represent the signed integers -128 to +127 using this representation. What if I do (+1) + (+127) = The number +128 is OUT of the RANGE that I can represent with 8 bits. What happens when I do the binary addition? +127 = \$ 7F + +1 = \$ /= \$80 (this is actually -128 as a twos complement number!!! - the wrong answer!!!) How do I know if overflowed occurred? Added two POSITIVE numbers, and got a NEGATIVE result. V Detecting Two s Complement Overflow Two s complement overflow occurs is: Add two POSITIVE numbers and get a NEGATIVE result Add two NEGATIVE numbers and get a POSITIVE result I CANNOT get two s complement overflow if I add a NEGATIVE and a POSITIVE number together. The Carry out of the Most Significant Bit means nothing if the numbers are two s complement numbers. V Some Examples All hex numbers represent signed decimal in two s complement format. \$ FF = -1 \$ FF = -1 + \$ 01 = \$ 00 = 0 Note there is a carry out, but the answer is correct. Can t have 2 s complement overflow when adding positive and negative number. + \$ 80 = \$ 7F = +127 (incorrect!!) Added two negative numbers, got a positive number. Twos Complement overflow. V Adding Precision (unsigned) What if we want to take an unsigned number and add more bits to it? Just add zeros to the left. 128 = \$80 (8 bits) = \$0080 (16 bits) = \$ (32 bits) V Adding Precision (two s complement) What if we want to take a twos complement number and add more bits to it? Take whatever the SIGN BIT is, and extend it to the left. Binary Codes (cont.) N bits (or N binary Digits) can represent 2 N different values. (for example, 4 bits can represent 2 4 or 16 different values) -128 = \$80 = % (8 bits) = \$FF80 = % (16 bits) = \$FFFFFF80 (32 bits) = \$7F = % (8 bits) = \$007F = % ( 16 bits) = \$ F (32 bits) This is called SIGN EXTENSION. Extending the MSB to the left works for two s complement numbers and unsigned N bits can take on unsigned decimal values from 0 to 2 N -1. Codes usually given in tabular form. numbers. V white V black red pink yellow brown blue green 7

8 Codes for Characters Also need to represent Characters as digital data. The ASCII code (American Standard Code for Information Interchange) is a 7-bit code for Character data. Typically 8 bits are actually used with the 8th bit being zero or used for error detection (parity checking). 8 bits = 1 Byte. (see Table 2.5, pg 47, Uffenbeck). ASCII American Standard Code for Information Interchange A = % = \$41 & = % = \$26 7 bits can only represent 2 7 different values (128). This enough to represent the Latin alphabet (A-Z, a-z, 0-9, punctuation marks, some symbols like \$), but what about other symbols or other languages? V V UNICODE UNICODE is a 16-bit code for representing alphanumeric data. With 16 bits, can represent 2 16 or different symbols. 16 bits = 2 Bytes per character. \$ A A-Z \$ A a-z Some other alphabet/symbol ranges \$3400-3d2d Korean Hangul Symbols \$ F Hiranga, Katakana, Bopomofo, Hangul \$4E00-9FFF Han (Chinese, Japenese, Korean) UNICODE used by Web browsers, Java, most software these Codes for Decimal Digits There are even codes for representing decimal digits. These codes use 4-bits for EACH decimal digits; it is NOT the same as converting from decimal to binary. BCD Code 0 = % = % = % = % = % = % = % = % = % = % 1001 In BCD code, each decimal digit simply represented by its binary equivalent. 96 = % = \$ 96 (BCD code) Advantage: easy to convert Disadvantage: takes more bits to store a number: 255 = % = \$ FF (binary code) 255 = % = \$ 255 (BCD code) takes only 8 bits in binary, takes 12 bits in BCD. days. V V Gray Code 0 = % = % = % = % = % = % = % = % = % = % 1000 Gray Code for decimal Digits A Gray code changes by only 1 bit for adjacent values. This is also called a thumbwheel code because a thumbwheel for choosing a decimal digit can only change to an adjacent value (4 to 5 to 6, etc) with each click of the thumbwheel. This allows the binary output of the thumbwheel to only change one bit at a time; this can help reduce circuit complexity and also reduce signal noise. What do you need to Know? Convert hex, binary integers to Decimal Convert decimal integers to hex, binary Convert hex to binary, binary to Hex N binary digits can represent 2 N values, unsigned integers 0 to 2 N -1. Addition, subtraction of binary, hex numbers Detecting unsigned overflow Converting a decimal number to Twos Complement Converting a hex number in 2s complement to decimal V V

9 What do you need to know? (cont) Number ranges for 2s complement Overflow in 2s complement Sign extension in 2s complement ASCII, UNICODE are binary codes for character data BCD code is alternate code for representing decimal digits Gray codes can also represent decimal digits; adjacent values in Gray codes change only by one bit. V

### Binary Representation. Number Systems. Positional Notation

Binary Representation The basis of all digital data is binary representation. Binary - means two 1, 0 True, False Hot, Cold On, Off We must be able to handle more than just values for real world problems

### Binary Representation

Binary Representation The basis of all digital data is binary representation. Binary - means two 1, 0 True, False Hot, Cold On, Off We must tbe able to handle more than just values for real world problems

### Binary Numbers Again. Binary Arithmetic, Subtraction. Binary, Decimal addition

Binary Numbers Again Recall than N binary digits (N bits) can represent unsigned integers from 0 to 2 N -1. 4 bits = 0 to 15 8 bits = 0 to 255 16 bits = 0 to 65535 Besides simply representation, we would

### Digital Fundamentals

Digital Fundamentals with PLD Programming Floyd Chapter 2 29 Pearson Education Decimal Numbers The position of each digit in a weighted number system is assigned a weight based on the base or radix of

### 1 Basic Computing Concepts (4) Data Representations

1 Basic Computing Concepts (4) Data Representations The Binary System The Binary System is a way of writing numbers using only the digits 0 and 1. This is the method used by the (digital) computer. The

### Oct: 50 8 = 6 (r = 2) 6 8 = 0 (r = 6) Writing the remainders in reverse order we get: (50) 10 = (62) 8

ECE Department Summer LECTURE #5: Number Systems EEL : Digital Logic and Computer Systems Based on lecture notes by Dr. Eric M. Schwartz Decimal Number System: -Our standard number system is base, also

### EE 261 Introduction to Logic Circuits. Module #2 Number Systems

EE 261 Introduction to Logic Circuits Module #2 Number Systems Topics A. Number System Formation B. Base Conversions C. Binary Arithmetic D. Signed Numbers E. Signed Arithmetic F. Binary Codes Textbook

### Logic Design. Dr. Yosry A. Azzam

Logic Design Dr. Yosry A. Azzam Binary systems Chapter 1 Agenda Binary Systems : Binary Numbers, Binary Codes, Binary Logic ASCII Code (American Standard Code for Information Interchange) Boolean Algebra

### LSN 2 Number Systems. ECT 224 Digital Computer Fundamentals. Department of Engineering Technology

LSN 2 Number Systems Department of Engineering Technology LSN 2 Decimal Number System Decimal number system has 10 digits (0-9) Base 10 weighting system... 10 5 10 4 10 3 10 2 10 1 10 0. 10-1 10-2 10-3

### 2.1 Binary Numbers. 2.3 Number System Conversion. From Binary to Decimal. From Decimal to Binary. Section 2 Binary Number System Page 1 of 8

Section Binary Number System Page 1 of 8.1 Binary Numbers The number system we use is a positional number system meaning that the position of each digit has an associated weight. The value of a given number

### Encoding Systems: Combining Bits to form Bytes

Encoding Systems: Combining Bits to form Bytes Alphanumeric characters are represented in computer storage by combining strings of bits to form unique bit configuration for each character, also called

### 2011, The McGraw-Hill Companies, Inc. Chapter 3

Chapter 3 3.1 Decimal System The radix or base of a number system determines the total number of different symbols or digits used by that system. The decimal system has a base of 10 with the digits 0 through

### By the end of the lecture, you should be able to:

Extra Lecture: Number Systems Objectives - To understand: Base of number systems: decimal, binary, octal and hexadecimal Textual information stored as ASCII Binary addition/subtraction, multiplication

### الدكتور المھندس عادل مانع داخل

الدكتور المھندس عادل مانع داخل / میسان جامعة / كلیة الھندسة قسم الھندسة الكھرباي یة Chapter 1: Digital Systems Discrete Data Examples: 26 letters of the alphabet (A, B etc) 10 decimal digits (0, 1, 2 etc)

### The string of digits 101101 in the binary number system represents the quantity

Data Representation Section 3.1 Data Types Registers contain either data or control information Control information is a bit or group of bits used to specify the sequence of command signals needed for

### Data Representation in Computers

Chapter 3 Data Representation in Computers After studying this chapter the student will be able to: *Learn about binary, octal, decimal and hexadecimal number systems *Learn conversions between two different

### COMP2121: Microprocessors and Interfacing

Interfacing Lecture 3: Number Systems (I) http://www.cse.unsw.edu.au/~cs2121 Lecturer: Hui Wu Session 2, 2005 Overview Positional notation Decimal, hexadecimal and binary One complement Two s complement

### Digital Logic. The Binary System is a way of writing numbers using only the digits 0 and 1. This is the method used by the (digital) computer.

Digital Logic 1 Data Representations 1.1 The Binary System The Binary System is a way of writing numbers using only the digits 0 and 1. This is the method used by the (digital) computer. The system we

### Lecture 11: Number Systems

Lecture 11: Number Systems Numeric Data Fixed point Integers (12, 345, 20567 etc) Real fractions (23.45, 23., 0.145 etc.) Floating point such as 23. 45 e 12 Basically an exponent representation Any number

### Computer Science 281 Binary and Hexadecimal Review

Computer Science 281 Binary and Hexadecimal Review 1 The Binary Number System Computers store everything, both instructions and data, by using many, many transistors, each of which can be in one of two

### Switching Circuits & Logic Design

Switching Circuits & Logic Design Jie-Hong Roland Jiang 江介宏 Department of Electrical Engineering National Taiwan University Fall 2013 1 1 Number Systems and Conversion Babylonian number system (3100 B.C.)

### Here 4 is the least significant digit (LSD) and 2 is the most significant digit (MSD).

Number System Introduction Number systems provide the basis for all operations in information processing systems. In a number system the information is divided into a group of symbols; for example, 26

### NUMBERING SYSTEMS C HAPTER 1.0 INTRODUCTION 1.1 A REVIEW OF THE DECIMAL SYSTEM 1.2 BINARY NUMBERING SYSTEM

12 Digital Principles Switching Theory C HAPTER 1 NUMBERING SYSTEMS 1.0 INTRODUCTION Inside today s computers, data is represented as 1 s and 0 s. These 1 s and 0 s might be stored magnetically on a disk,

Review of Number Systems The study of number systems is important from the viewpoint of understanding how data are represented before they can be processed by any digital system including a computer. Different

### Radix Number Systems. Number Systems. Number Systems 4/26/2010. basic idea of a radix number system how do we count:

Number Systems binary, octal, and hexadecimal numbers why used conversions, including to/from decimal negative binary numbers floating point numbers character codes basic idea of a radix number system

### Chapter II Binary Data Representation

Chapter II Binary Data Representation The atomic unit of data in computer systems is the bit, which is actually an acronym that stands for BInary digit. It can hold only 2 values or states: 0 or 1, true

### The largest has a 0 in the sign position and 0's in all other positions:

10.2 Sign Magnitude Representation Sign Magnitude is straight-forward method for representing both positive and negative integers. It uses the most significant digit of the digit string to indicate the

### CDA 3200 Digital Systems. Instructor: Dr. Janusz Zalewski Developed by: Dr. Dahai Guo Spring 2012

CDA 3200 Digital Systems Instructor: Dr. Janusz Zalewski Developed by: Dr. Dahai Guo Spring 2012 Outline Data Representation Binary Codes Why 6-3-1-1 and Excess-3? Data Representation (1/2) Each numbering

### Number Representation and Arithmetic in Various Numeral Systems

1 Number Representation and Arithmetic in Various Numeral Systems Computer Organization and Assembly Language Programming 203.8002 Adapted by Yousef Shajrawi, licensed by Huong Nguyen under the Creative

### EEE130 Digital Electronics I Lecture #2

EEE130 Digital Electronics I Lecture #2 -Number Systems, Operations and Codes- By Dr. Shahrel A. Suandi Topics to be discussed 2-1 Decimal Numbers 2-2 Binary Numbers 2-3 Decimal-to-Binary Conversion 2-4

### MT1 Number Systems. In general, the number a 3 a 2 a 1 a 0 in a base b number system represents the following number:

MT1 Number Systems MT1.1 Introduction A number system is a well defined structured way of representing or expressing numbers as a combination of the elements of a finite set of mathematical symbols (i.e.,

### Data Representation Binary Numbers

Data Representation Binary Numbers Integer Conversion Between Decimal and Binary Bases Task accomplished by Repeated division of decimal number by 2 (integer part of decimal number) Repeated multiplication

### Number Systems and. Data Representation

Number Systems and Data Representation 1 Lecture Outline Number Systems Binary, Octal, Hexadecimal Representation of characters using codes Representation of Numbers Integer, Floating Point, Binary Coded

### Levent EREN levent.eren@ieu.edu.tr A-306 Office Phone:488-9882 INTRODUCTION TO DIGITAL LOGIC

Levent EREN levent.eren@ieu.edu.tr A-306 Office Phone:488-9882 1 Number Systems Representation Positive radix, positional number systems A number with radix r is represented by a string of digits: A n

### A B C

Data Representation Module 2 CS 272 Sam Houston State University Dr. Tim McGuire Copyright 2001 by Timothy J. McGuire, Ph.D. 1 Positional Number Systems Decimal (base 10) is an example e.g., 435 means

### Integer Numbers. The Number Bases of Integers Textbook Chapter 3

Integer Numbers The Number Bases of Integers Textbook Chapter 3 Number Systems Unary, or marks: /////// = 7 /////// + ////// = ///////////// Grouping lead to Roman Numerals: VII + V = VVII = XII Better:

### Digital Arithmetic. Digital Arithmetic: Operations and Circuits Dr. Farahmand

Digital Arithmetic Digital Arithmetic: Operations and Circuits Dr. Farahmand Binary Arithmetic Digital circuits are frequently used for arithmetic operations Fundamental arithmetic operations on binary

### EE 3170 Microcontroller Applications

EE 37 Microcontroller Applications Lecture 3 : Digital Computer Fundamentals - Number Representation (.) Based on slides for ECE37 by Profs. Sloan, Davis, Kieckhafer, Tan, and Cischke Number Representation

### Digital Electronics. 1.0 Introduction to Number Systems. Module

Module 1 www.learnabout-electronics.org Digital Electronics 1.0 Introduction to What you ll learn in Module 1 Section 1.0. Recognise different number systems and their uses. Section 1.1 in Electronics.

### 1 Number System (Lecture 1 and 2 supplement)

1 Number System (Lecture 1 and 2 supplement) By Dr. Taek Kwon Many different number systems perhaps from the prehistoric era have been developed and evolved. Among them, binary number system is one of

### Understanding Binary Numbers. Different Number Systems. Conversion: Bin Hex. Conversion MAP. Binary (0, 1) Hexadecimal 0 9, A(10), B(11),, F(15) :

Understanding Binary Numbers Computers operate on binary values (0 and 1) Easy to represent binary values electrically Voltages and currents. Can be implemented using circuits Create the building blocks

### Signed Binary Arithmetic

Signed Binary Arithmetic In the real world of mathematics, computers must represent both positive and negative binary numbers. For example, even when dealing with positive arguments, mathematical operations

### Binary Numbers. Bob Brown Information Technology Department Southern Polytechnic State University

Binary Numbers Bob Brown Information Technology Department Southern Polytechnic State University Positional Number Systems The idea of number is a mathematical abstraction. To use numbers, we must represent

### Number Representation

Number Representation Number System :: The Basics We are accustomed to using the so-called decimal number system Ten digits ::,,,3,4,5,6,7,8,9 Every digit position has a weight which is a power of Base

### Chapter 2: Number Systems

Chapter 2: Number Systems Logic circuits are used to generate and transmit 1s and 0s to compute and convey information. This two-valued number system is called binary. As presented earlier, there are many

### CHAPTER 3 Number System and Codes

CHAPTER 3 Number System and Codes 3.1 Introduction On hearing the word number, we immediately think of familiar decimal number system with its 10 digits; 0,1, 2,3,4,5,6, 7, 8 and 9. these numbers are called

### Decimal Numbers: Base 10 Integer Numbers & Arithmetic

Decimal Numbers: Base 10 Integer Numbers & Arithmetic Digits: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 Example: 3271 = (3x10 3 ) + (2x10 2 ) + (7x10 1 )+(1x10 0 ) Ward 1 Ward 2 Numbers: positional notation Number

### ELECTRICAL AND COMPUTER ENGINEERING DEPARTMENT, OAKLAND UNIVERSITY ECE-378: Digital Logic and Microprocessor Design Winter 2015.

ECE-378: Digital Logic and Microprocessor Design Winter 5 UNSIGNED INTEGER NUMBERS Notes - Unit 4 DECIMAL NUMBER SYSTEM A decimal digit can take values from to 9: Digit-by-digit representation of a positive

### Number Systems and Data Representation CS221

Number Systems and Data Representation CS221 Inside today s computers, data is represented as 1 s and 0 s. These 1 s and 0 s might be stored magnetically on a disk, or as a state in a transistor, core,

### CPEN 214 - Digital Logic Design Binary Systems

CPEN 4 - Digital Logic Design Binary Systems C. Gerousis Digital Design 3 rd Ed., Mano Prentice Hall Digital vs. Analog An analog system has continuous range of values A mercury thermometer Vinyl records

### CSC 1103: Digital Logic. Lecture Six: Data Representation

CSC 1103: Digital Logic Lecture Six: Data Representation Martin Ngobye mngobye@must.ac.ug Mbarara University of Science and Technology MAN (MUST) CSC 1103 1 / 32 Outline 1 Digital Computers 2 Number Systems

### CPE 323 Data Types and Number Representations

CPE 323 Data Types and Number Representations Aleksandar Milenkovic Numeral Systems: Decimal, binary, hexadecimal, and octal We ordinarily represent numbers using decimal numeral system that has 10 as

### ELECTRICAL AND COMPUTER ENGINEERING DEPARTMENT, OAKLAND UNIVERSITY ECE-470/570: Microprocessor-Based System Design Fall 2014.

REVIEW OF NUMBER SYSTEMS Notes Unit 2 BINARY NUMBER SYSTEM In the decimal system, a decimal digit can take values from to 9. For the binary system, the counterpart of the decimal digit is the binary digit,

### Presented By: Ms. Poonam Anand

Presented By: Ms. Poonam Anand Know the different types of numbers Describe positional notation Convert numbers in other bases to base 10 Convert base 10 numbers into numbers of other bases Describe the

### Lecture 2. Binary and Hexadecimal Numbers

Lecture 2 Binary and Hexadecimal Numbers Purpose: Review binary and hexadecimal number representations Convert directly from one base to another base Review addition and subtraction in binary representations

### Binary Numbers. X. Zhang Fordham Univ.

Binary Numbers X. Zhang Fordham Univ. 1 Numeral System! A way for expressing numbers, using symbols in a consistent manner.!! "11" can be interpreted differently:!! in the binary symbol: three!! in the

### Introduction Number Systems and Conversion

UNIT 1 Introduction Number Systems and Conversion Objectives 1. Introduction The first part of this unit introduces the material to be studied later. In addition to getting an overview of the material

### Chapter 2 Numeric Representation.

Chapter 2 Numeric Representation. Most of the things we encounter in the world around us are analog; they don t just take on one of two values. How then can they be represented digitally? The key is that

### Computer Number Systems

Computer Number Systems Thorne, Edition 2 : Section 1.3, Appendix I (Irvine, Edition VI : Section 1.3) SYSC3006 1 Starting from What We Already Know Decimal Numbers Based Number Systems : 1. Base defines

### 1. Number Representation

CSEE 3827: Fundamentals of Computer Systems, Spring 2011 1. Number Representation Prof. Martha Kim (martha@cs.columbia.edu) Web: http://www.cs.columbia.edu/~martha/courses/3827/sp11/ Contents (H&H 1.3-1.4,

### Number Systems & Encoding

Number Systems & Encoding Lecturer: Sri Parameswaran Author: Hui Annie Guo Modified: Sri Parameswaran Week2 1 Lecture overview Basics of computing with digital systems Binary numbers Floating point numbers

### Systems I: Computer Organization and Architecture

Systems I: Computer Organization and Architecture Lecture 2: Number Systems and Arithmetic Number Systems - Base The number system that we use is base : 734 = + 7 + 3 + 4 = x + 7x + 3x + 4x = x 3 + 7x

### Activity 1: Bits and Bytes

ICS3U (Java): Introduction to Computer Science, Grade 11, University Preparation Activity 1: Bits and Bytes The Binary Number System Computers use electrical circuits that include many transistors and

### Binary Representation and Computer Arithmetic

Binary Representation and Computer Arithmetic The decimal system of counting and keeping track of items was first created by Hindu mathematicians in India in A.D. 4. Since it involved the use of fingers

### Useful Number Systems

Useful Number Systems Decimal Base = 10 Digit Set = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9} Binary Base = 2 Digit Set = {0, 1} Octal Base = 8 = 2 3 Digit Set = {0, 1, 2, 3, 4, 5, 6, 7} Hexadecimal Base = 16 = 2

### Assembly Language for Intel-Based Computers, 4 th Edition. Chapter 1: Basic Concepts. Chapter Overview. Welcome to Assembly Language

Assembly Language for Intel-Based Computers, 4 th Edition Kip R. Irvine Chapter 1: Basic Concepts Slides prepared by Kip R. Irvine Revision date: 10/27/2002 Chapter corrections (Web) Printing a slide show

### CHAPTER 2 Data Representation in Computer Systems

CHAPTER 2 Data Representation in Computer Systems 2.1 Introduction 47 2.2 Positional Numbering Systems 48 2.3 Converting Between Bases 48 2.3.1 Converting Unsigned Whole Numbers 49 2.3.2 Converting Fractions

### EEM 232 Digital System I

EEM 232 Digital System I Instructor : Assist. Prof. Dr. Emin Germen egermen@anadolu.edu.tr Course Book : Logic and Computer Design Fundamentals by Mano & Kime Third Ed/Fourth Ed.. Pearson Grading 1 st

### CSI 333 Lecture 1 Number Systems

CSI 333 Lecture 1 Number Systems 1 1 / 23 Basics of Number Systems Ref: Appendix C of Deitel & Deitel. Weighted Positional Notation: 192 = 2 10 0 + 9 10 1 + 1 10 2 General: Digit sequence : d n 1 d n 2...

### CHAPTER THREE. 3.1 Binary Addition. Binary Math and Signed Representations

CHAPTER THREE Binary Math and Signed Representations Representing numbers with bits is one thing. Doing something with them is an entirely different matter. This chapter discusses some of the basic mathematical

### NUMBER SYSTEMS. 1.1 Introduction

NUMBER SYSTEMS 1.1 Introduction There are several number systems which we normally use, such as decimal, binary, octal, hexadecimal, etc. Amongst them we are most familiar with the decimal number system.

### Arithmetic of Number Systems

2 Arithmetic of Number Systems INTRODUCTION Arithmetic operations in number systems are usually done in binary because designing of logic networks is much easier than decimal. In this chapter we will discuss

### EE 308 Spring Binary, Hex and Decimal Numbers (4-bit representation) Binary. Hex. Decimal A B C D E F

EE 8 Spring Binary, Hex and Decimal Numbers (-bit representation) Binary Hex 8 9 A B C D E F Decimal 8 9 EE 8 Spring What does a number represent? Binary numbers are a code, and represent what the programmer

### Number Systems Richard E. Haskell

NUMBER SYSTEMS D Number Systems Richard E. Haskell Data inside a computer are represented by binary digits or bits. The logical values of these binary digits are denoted by and, while the corresponding

### UNIT 2 : NUMBER SYSTEMS

UNIT 2 : NUMBER SYSTEMS page 2.0 Introduction 1 2.1 Decimal Numbers 2 2.2 The Binary System 3 2.3 The Hexadecimal System 5 2.4 Number Base Conversion 6 2.4.1 Decimal To Binary 6 2.4.2 Decimal to Hex 7

### 1.3 Data Representation

8628-28 r4 vs.fm Page 9 Thursday, January 2, 2 2:4 PM.3 Data Representation 9 appears at Level 3, uses short mnemonics such as ADD, SUB, and MOV, which are easily translated to the ISA level. Assembly

### Chapter 3: Number Systems

Slide 1/40 Learning Objectives In this chapter you will learn about: Non-positional number system Positional number system Decimal number system Binary number system Octal number system Hexadecimal number

### plc numbers - 13.1 Encoded values; BCD and ASCII Error detection; parity, gray code and checksums

plc numbers - 3. Topics: Number bases; binary, octal, decimal, hexadecimal Binary calculations; s compliments, addition, subtraction and Boolean operations Encoded values; BCD and ASCII Error detection;

### Number Representation

Number Representation CS10001: Programming & Data Structures Pallab Dasgupta Professor, Dept. of Computer Sc. & Engg., Indian Institute of Technology Kharagpur Topics to be Discussed How are numeric data

### Data types. lecture 4

Data types lecture 4 Information in digital computers is represented using binary number system. The base, i.e. radix, of the binary system is 2. Other common number systems: octal (base 8), decimal (base

### Number and codes in digital systems

Number and codes in digital systems Decimal Numbers You are familiar with the decimal number system because you use them everyday. But their weighted structure is not understood. In the decimal number

### Unit 2: Number Systems, Codes and Logic Functions

Unit 2: Number Systems, Codes and Logic Functions Introduction A digital computer manipulates discrete elements of data and that these elements are represented in the binary forms. Operands used for calculations

### Computer is a binary digital system. Data. Unsigned Integers (cont.) Unsigned Integers. Binary (base two) system: Has two states: 0 and 1

Computer Programming Programming Language Is telling the computer how to do something Wikipedia Definition: Applies specific programming languages to solve specific computational problems with solutions

### THE ISLAMIC UNIVERSITY OF GAZA ENGINEERING FACULTY DEPARTMENT OF COMPUTER ENGINEERING DIGITAL LOGIC DESIGN DISCUSSION ECOM Eng. Huda M.

THE ISLAMIC UNIVERSITY OF GAZA ENGINEERING FACULTY DEPARTMENT OF COMPUTER ENGINEERING DIGITAL LOGIC DESIGN DISCUSSION ECOM 2012 Eng. Huda M. Dawoud September, 2015 1.1 List the octal and hexadecimal numbers

### Number Systems and Base Conversions

Number Systems and Base Conversions As you know, the number system that we commonly use is the decimal or base- 10 number system. That system has 10 digits, 0 through 9. While it's very convenient for

### Number System. Some important number systems are as follows. Decimal number system Binary number system Octal number system Hexadecimal number system

Number System When we type some letters or words, the computer translates them in numbers as computers can understand only numbers. A computer can understand positional number system where there are only

### Binary Numbers. Binary Numbers. Wolfgang Schreiner Research Institute for Symbolic Computation (RISC) Johannes Kepler University, Linz, Austria

Binary Numbers Wolfgang Schreiner Research Institute for Symbolic Computation (RISC) Johannes Kepler University, Linz, Austria Wolfgang.Schreiner@risc.uni-linz.ac.at http://www.risc.uni-linz.ac.at/people/schreine

### 2. Number Systems - Positional Number Systems (1) - 2. Number Systems - Binary Numbers - 2. Number Systems - Positional Number Systems (2) -

Sistemas Digitais I LESI - 2º ano Lesson 2 - Number Systems Prof. João Miguel Fernandes (miguel@di.uminho.pt) Dept. Informática - Positional Number Systems (1) - We use daily a positional number system.

### Common Number Systems Number Systems

5/29/204 Common Number Systems Number Systems System Base Symbols Used by humans? Used in computers? Decimal 0 0,, 9 Yes No Binary 2 0, No Yes Octal 8 0,, 7 No No Hexadecimal 6 0,, 9, A, B, F No No Number

### Chapter 2. Binary Values and Number Systems

Chapter 2 Binary Values and Number Systems Numbers Natural numbers, a.k.a. positive integers Zero and any number obtained by repeatedly adding one to it. Examples: 100, 0, 45645, 32 Negative numbers A

### Data Representation. Data Representation, Storage, and Retrieval. Data Representation. Data Representation. Data Representation. Data Representation

, Storage, and Retrieval ULM/HHIM Summer Program Project 3, Day 3, Part 3 Digital computers convert the data they process into a digital value. Text Audio Images/Graphics Video Digitizing 00000000... 6/8/20

### Note that the exponents also decrease by 1 with each column move to the right, so the

Base Systems Jacqueline A. Jones People use the decimal number system to perform arithmetic operations. Computers, on the other hand, use the binary system, which contains only two digits: 0 and 1. We

### Integer and Real Numbers Representation in Microprocessor Techniques

Brno University of Technology Integer and Real Numbers Representation in Microprocessor Techniques Microprocessor Techniques and Embedded Systems Lecture 1 Dr. Tomas Fryza 30-Sep-2011 Contents Numerical

### Binary Numbers. Binary Numbers. Wolfgang Schreiner Research Institute for Symbolic Computation (RISC) Johannes Kepler University, Linz, Austria

Binary Numbers Wolfgang Schreiner Research Institute for Symbolic Computation (RISC) Johannes Kepler University, Linz, Austria Wolfgang.Schreiner@risc.uni-linz.ac.at http://www.risc.uni-linz.ac.at/people/schreine

### CSCI 230 Class Notes Binary Number Representations and Arithmetic

CSCI 230 Class otes Binary umber Representations and Arithmetic Mihran Tuceryan with some modifications by Snehasis Mukhopadhyay Jan 22, 1999 1 Decimal otation What does it mean when we write 495? How

### Goals. Unary Numbers. Decimal Numbers. 3,148 is. 1000 s 100 s 10 s 1 s. Number Bases 1/12/2009. COMP370 Intro to Computer Architecture 1

Number Bases //9 Goals Numbers Understand binary and hexadecimal numbers Be able to convert between number bases Understand binary fractions COMP37 Introduction to Computer Architecture Unary Numbers Decimal

### 198:211 Computer Architecture

198:211 Computer Architecture Topics: Lecture 8 (W5) Fall 2012 Data representation 2.1 and 2.2 of the book Floating point 2.4 of the book 1 Computer Architecture What do computers do? Manipulate stored

### CHAPTER TWO. 2.1 Unsigned Binary Counting. Numbering Systems

CHAPTER TWO Numbering Systems Chapter one discussed how computers remember numbers using transistors, tiny devices that act like switches with only two positions, on or off. A single transistor, therefore,