### Create a StudySoup account

#### Be part of our community, it's free to join!

Already have a StudySoup account? Login here

# Class Note for ENGIN 112 at UMass(32)

### View Full Document

## 27

## 0

## Popular in Course

## Popular in Department

This 19 page Class Notes was uploaded by an elite notetaker on Friday February 6, 2015. The Class Notes belongs to a course at University of Massachusetts taught by a professor in Fall. Since its upload, it has received 27 views.

## Similar to Course at UMass

## Reviews for Class Note for ENGIN 112 at UMass(32)

### What is Karma?

#### Karma is the currency of StudySoup.

#### You can buy or earn more Karma at anytime and redeem it for class notes, study guides, flashcards, and more!

Date Created: 02/06/15

ENGIN 112 Intro to Electrical and Computer Engineering Lectu re 3 More Number Systems quot ELECTRICAL 9 quot COMPUTER ENGINEERING umvsnswv or MASSACHUSETTS AMHERST ENGIN11Z L3 Mum Number Systems SepIemhernznn3 Overview Hexadecimal numbers Related to binary and octal numbers Conversion between hexadecimal octal and binary Value ranges of numbers Representing positive and negative numbers Creating the complement of a number Make a positive number negative and vice versa Why binary ENGN112 L3 More Number Systems September 8 2003 Understanding Binary Numbers Binary numbers are made of binary digits bits 0 and 1 How many items does an binary number represent 10112 1x23 0x221x211x2 1110 What about fractions 110102 1x22 1x210x20 1x21 0x22 Groups of eight bits are called a byte 11oo1oo12 Groups of four bits are called a nibble 1101 2 ENGN112 L3 More Number Systems September 8 2003 Understanding Hexadecimal Numbers Hexadecimal numbers are made of digits 0123456789A B C D E How many items does an hex number represent 3A9F16 3x163 10x162 9x16115x16 1499910 What about fractions 203516 2x162 13x161 3x160 5x16391 72331251o Note that each hexadecimal digit can be represented with four bits 1110 2 E16 Groups of four bits are called a nibble 1110 2 ENGN112 L3 More Number Systems September 8 2003 Putting It All Together DCL i mu O 1 Z 5 ENGINHZ L3 More Number Systems Binary 0 1 10 11 100 101 110 111 1000 1001 1010 1011 1100 1101 1110 1111 OCHKI 16 Hexadecimal zj m pmxumw awmwo o Binar octal anq hexa ecrmal sImIIar Easy to build circuits to operate on these representations Possible to convert between the three formats September a zoos Converting Between Base 16 and Base 2 3A9F16 0011 10101001 11112 3 A 9 F Conversion is easy gt Determine 4bit value for each hex digit shite that there are 24 16 different values of four I s Easier to read and write in hexadecimal Representations are equivalent ENGN112 L3 More Number Systems September 8 2003 Converting Between Base 16 and Base 8 3A9F16 0011 10101001 11112 3 A 9 F i 352378 m 1m w w 1112 3 5 2 3 7 Convert from Base 16 to Base 2 Regroup bits into groups of three starting from right Ignore leading zeros PPNT Each group of three bits forms an octal digit ENGN112 L3 More Number Systems September 8 2003 How To Represent Signed Numbers Plus and minus sign used for decimal numbers 25 or 25 16 etc For computers desirable to represent everything as bits Three types of signed binary number representations signed magnitude 1 s complement 2 s complement In each case leftmost bit indicates sign positive 0 or negative 1 Consider signed magnitude 0000110021210 100011002 4210 Sign bit Magnitude Sign bit Magnitude ENGN112 L3 More Number Systems September 8 2003 One s Complement Representation The one s complement of a binary number involves inverting all bits 1 s comp of 00110011 is 11001100 1 s comp of 10101010 is 01010101 For an n bit number N the 1 s complement is Zn1 N Called diminished radix complement b Mano since 1 s complement for base radix To find negative of 1 s complement number take the 1 s complement OOOO110021210 111100112 1210 Sign bit Magnitude Sign bit Magnitude ENGN112 L3 More Number Systems September 8 2003 Two s Complement Representation The two s complement of a binary number involves inverting all bits and adding 1 2 s comp of 00110011 is 11001101 2 s comp of 10101010 is 01010110 For an n bit number N the 2 s complement is 2 4 N 1 Called radix complement by Mano since 2 s complement for base radix 2 To find negative of 2 s complement number take the 2 s complement 0000110021210 111101002 4210 Sign bit Magnitude Sign bit Magnitude ENGN112 L3 More Number Systems September 8 2003 Two s Complement Shortcuts Algorithm 1 Simply complement each bit and then add 1 to the result Finding the 2 s complement of 011001012 and of its 2 s complement N 01100101 N 10011011 10011010 01100100 1 1 10011011 01100101 Algorithm 2 Starting with the least significant bit copy all of the bits up to and including the first 1 bIt and then complementing the remaining bIts N o11oo1o1 N 1oo11o11 ENGN112 L3 More Number Systems September 8 2003 Finite Number Representation Machines that use 2 s complement arithmetic can represent integers in the range 2n1 lt N lt 2n11 where n is the number of bits available for representin N Note that 2n11 011112 and 2quot1 00002 oFor 2 s complement more negative numbers than posmve oFor 1 s complement two representations for zero oFor an n bit number in base radix 2 there are zn different unsigned values 0 1 1 ENGN112 L3 More Number Systems September 8 2003 1 s Complement Addition Using 1 s complement numbers adding numbers is easy For example suppose we wish to add 11002 and 00012 Let s compute 1210 110 121o 11002 011002in 1 s comp 110 ooo12 000012in1 s comp Step 1 Add binary numbers Step 2 Add carry to loworder bit ENGN112 L3 More Number Systems Add Final Result 0 l l O 1 September 8 2003 1 s Complement Subtraction Usin 1 scompement numbers subtracting num ers IS also easy For exam le suppose we wish to subtract 00012 rom 1 002 o O l l O O Lets compute 121o 110 0 0 0 0 1 1210 11002 011002 in 1 s comp 110 00012 111102in 1 s comp 1 s comp O l l O 0 Step 1 Take 1 s complement of 2nd operand Add l l l l 0 Step 2 Add binary numbers Step 3 Add carry to low order bit ENGN112 L3 More Number Systems September 8 2003 2 s Complement Addition is easy and 00012 Let s compute 1210 110 121o 11002 011002in 2 s 11o ooo12 000012in 2 s Step 1 Add binary numbers Step 2 Ignore carry bit ENGN112 L3 More Number Systems Using 2 s complement numbers adding numbers For example suppose we wish to add 11002 comp COmP 0 1 1 0 0 Add O O O O 1 Final 0 0 1 1 0 1 Result Ignore September 8 2003 2 s Complement Subtraction Using 2 s complement numbers follow steps for subtraction For exam le suppose we wish to subtract 00012 rom 1 002 Let s compute 1210110 0 0 O O l 1210 11002 011002 in 2 s comp 11o 00012 111112in 2 s comp 2 s comp O l l O 0 Step 1 Take 2 s complement of 2nd operand Add l l l l 1 Step 2 Add binary numbers Step 3 Ignore carry bit Final Result Ignore Carry ENGN112 L3 More Number Systems September 8 2003 2 s Complement Subtraction Example 2 Let s compute 1310 510 131o 11o12 o11o12 51o o1o12 11o112 Adding these two 5bit codes 1 carry l l O l O l O O 0 Discarding the carry bit the si n bit is seen to be zero indicating a correct resul Indeed 010002 10002 810 ENGN112 L3 More Number Systems September 8 2003 2 s Complement Subtraction Example 3 Let s compute 510 12 1210 11002 1o1002 510 o1o12 oo1o12 Adding these two 5bit codes 0 O 1 O 1 11001 Here there is no carry bit and the sign bit is 1 This indicates a negative result which is what we expect 110012 710 ENGN112 L3 More Number Systems September 8 2003 Summary Bina numbers can also be represented in octal and hexa ecumal Easy to convert between binary octal and hexadecimal Signed numbers represented in signed magnitude 1 s complement and 2 s complement 2 s com lement most important only 1 representation for zero Important to understand treatment of sign bit for 1 s and 2 s complement 34 g ENGN112 L3 More Number Systems September 8 2003

### BOOM! Enjoy Your Free Notes!

We've added these Notes to your profile, click here to view them now.

### You're already Subscribed!

Looks like you've already subscribed to StudySoup, you won't need to purchase another subscription to get this material. To access this material simply click 'View Full Document'

## Why people love StudySoup

#### "I was shooting for a perfect 4.0 GPA this semester. Having StudySoup as a study aid was critical to helping me achieve my goal...and I nailed it!"

#### "I made $350 in just two days after posting my first study guide."

#### "Knowing I can count on the Elite Notetaker in my class allows me to focus on what the professor is saying instead of just scribbling notes the whole time and falling behind."

#### "Their 'Elite Notetakers' are making over $1,200/month in sales by creating high quality content that helps their classmates in a time of need."

### Refund Policy

#### STUDYSOUP CANCELLATION POLICY

All subscriptions to StudySoup are paid in full at the time of subscribing. To change your credit card information or to cancel your subscription, go to "Edit Settings". All credit card information will be available there. If you should decide to cancel your subscription, it will continue to be valid until the next payment period, as all payments for the current period were made in advance. For special circumstances, please email support@studysoup.com

#### STUDYSOUP REFUND POLICY

StudySoup has more than 1 million course-specific study resources to help students study smarter. If you’re having trouble finding what you’re looking for, our customer support team can help you find what you need! Feel free to contact them here: support@studysoup.com

Recurring Subscriptions: If you have canceled your recurring subscription on the day of renewal and have not downloaded any documents, you may request a refund by submitting an email to support@studysoup.com

Satisfaction Guarantee: If you’re not satisfied with your subscription, you can contact us for further help. Contact must be made within 3 business days of your subscription purchase and your refund request will be subject for review.

Please Note: Refunds can never be provided more than 30 days after the initial purchase date regardless of your activity on the site.