Representation of Numbers - NYU

Representations Example: Numbers 145 CVL 10010001 91

Meaning of Number Representation Examples: 145 = 1*102 + 4*101 + 5*100 Decimal

CVL = 100 5 + 50 Roman 10010001=1*27 + 1*24 + 1*20 Binary 91 = 9*161 + 1*160 Hexadecimal = 100 + 10+10+10+10+1+1+1+1+1 Egypt = 2*60 + 10+10+5 Babylon =7*20 + 5 Maya Meaning of Numbers: Convention/Agreement Any number consists of symbols

The value of a number is defined by a set of rules of how to interpret these symbols Most systems have a base number 10 2 8 16 Decimal Binary

Octal Hexadecimal What makes a good representations? Meet certain constraints on the symbols Intuitive interpretation Can express everything you need !! Support for frequent operations Efficiency

Space What do we want to represent: Data Types Set of objects of the same kind Defined by a way of representing each object a group of operations to perform on such objects Basic data types of computer

integers (unsigned and signed) plain text characters bit vectors (floating point numbers) Computer Representation Computer representation: Symbols: 0,1 Words = sequence of k symbols (bits) 8 bit =1 byte notation for an unknown k-bit word: ak-1a k-2 a1a0 ak-1is called the most significant bit

a0 is called the least significant bit k is always a power of 2: 16 or 32 Unsigned Integer Representation 145=1*102 + 4*101 + 5*100 10010001ui Decimal Binary =1*27 +0*26+0*25 +1*24 +0*23 +0*22 +0*21 +1*20 =1*128+0*64+0*32+1*16+0*8+0*4+0*2+1*0 =145

Multiply and Add Algorithm How good is unsigned integer? Positive Uses only 0 and 1 Easy addition and conversion to decimal Negative Limited size (2k) for k-bit word No negative Limited subtraction Signed Integers need to represent both non-negative and negative integers

need to be able to perform the following operations addition (using the same rules as before) negation subtraction (trivial) three different representations will be considered in all three representations words whose most significant bit is 0 represent the same non-negative integer Signed Magnitude Most significant bit determines whether the number is positive (ak-1=0, as before ) or negative (ak-1=1) 1 1 1 0 0 k=4 1 1 1 0 (-6)

+ 0 1 1 1 (+7) 0 1 0 1 (+5) + We now have negative numbers Easy negation, only change first bit Addition does not work anymore Does not work! Ones Compliment

Positive number as before Negation is performed by inverting all bits Example: -6 = Inverse (6) = Inverse (0110) = 1001 test addition by adding 1001 with 0111 11110 1 0 0 1 (-6) + 0 1 1 1 (+7) 0 0 0 0 (0) Does not work!

Twos Compliment Positive as before Negation is performed by inverting all of the bits, and then adding 1 (binary) -6 = Inverse(6)+0001 = Inverse(0110)+0001 = 0110+0001=0111 test addition by adding 1010 with 0111 11100 1 0 1 0 (-6) + 0 1 1 1 (+7) 0 0 0 1 (+1) Twos compliment is useful for representing signed integers Things you should be able to do

Convert decimal number to binary and vice versa to all 4 forms of binary representation Addition in unsigned integer Addition and subtraction for twos complement Negation in twos complement Recognize the different subscripts: ui, sm, 1c,2c Understand why 2c is better than sm Know which representation (of the 4) is used for integer

Recently Viewed Presentations

  • 投影片 1 - Chinese University of Hong Kong

    投影片 1 - Chinese University of Hong Kong

    Title: 投影片 1 Author: Admin Last modified by: CUHK Created Date: 2/22/2012 1:16:13 AM Document presentation format: On-screen Show (4:3) Other titles
  • Naval Postgraduate School's 12th Annual Acquisition ... - HCI

    Naval Postgraduate School's 12th Annual Acquisition ... - HCI

    Acquisition Workforce Strategic Plan Goals Aligned with Defense Civilian Personnel Advisory Service. Make Department of Defense an Employer of Choice. Shape the Acquisition Workforce to achieve current and future Acquisition requirements. Improve the quality and professionalism of Acquisition Workforce
  • Welcome to Services Marketing

    Welcome to Services Marketing

    Intangibility and Inseparability. First discussed by French economist Jean-Baptiste Say (1803), using the example of a physician who visits a. patient, prescribes a remedy, and then leaves without. depositing any product: "[T]he physician's advice has been exchanged for his fee…....
  • Welcome Evening Monday 14th September

    Welcome Evening Monday 14th September

    Welcome Evening RACE to the top! Respectful Achieving Creative Enthusiastic Welcome to Primary 4 Mrs Lyall #Grow! Create! Shine! Aims of Meeting Informal- not specific for each child Face to name Report Format Routines and Expectations Subject Areas Homework Issues...
  • Corporate Diversification

    Corporate Diversification

    Value of Diversification Two Criteria 1) There must be some economy of scope 2) The focal firm must have a cost advantage over outside equity holders in exploiting any economies of scope Value of Diversification Business X Business Y Business...
  • A Christmas Carol - Weebly

    A Christmas Carol - Weebly

    A Christmas Carol By Charles Dickens About Charles Dickens Born February 7, 1812 to John and Elizabeth Dickens in Portsmouth, England. Charles was the second of eight children. Died of a stroke on June 9, 1870. Buried in Poet's Corner...
  • MIH Molar Incisor Hypomineralization

    MIH Molar Incisor Hypomineralization

    Compomer. RBC . Glass ionomers and resin-modified glass ionomers have poor wear resistance and are not recommended for placement in stress-bearing areas . The enamel-adhesive interface. Porous . Cracks. Decreased bond strength. Cohesive failure
  • Polar Bear - Lakewood High School

    Polar Bear - Lakewood High School

    Male Adults weigh about 775 pounds. Female adults weigh 330 to 550 pounds. They eat Seals, Whales, Reindeer, Walruses, Birds, and Eggs. Live up to an average of 15 to 18 years in the wild