slide1 n.
Download
Skip this Video
Loading SlideShow in 5 Seconds..
Department of Computer and Information Science, School of Science, IUPUI PowerPoint Presentation
Download Presentation
Department of Computer and Information Science, School of Science, IUPUI

Loading in 2 Seconds...

play fullscreen
1 / 10

Department of Computer and Information Science, School of Science, IUPUI - PowerPoint PPT Presentation


  • 106 Views
  • Uploaded on

Department of Computer and Information Science, School of Science, IUPUI. CSCI 230. Information Representation: Negative Integer Representation . Dale Roberts, Lecturer IUPUI droberts@cs.iupui.edu. Negative Numbers in Binary.

loader
I am the owner, or an agent authorized to act on behalf of the owner, of the copyrighted work described.
capcha
Download Presentation

PowerPoint Slideshow about 'Department of Computer and Information Science, School of Science, IUPUI' - nelson


An Image/Link below is provided (as is) to download presentation

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.


- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -
Presentation Transcript
slide1

Department of Computer and Information Science,School of Science, IUPUI

CSCI 230

Information Representation:

Negative Integer Representation

Dale Roberts, Lecturer

IUPUI

droberts@cs.iupui.edu

negative numbers in binary
Negative Numbers in Binary
  • Four different representation schemes are used for negative numbers
  • Signed Magnitude
      • Left most bit (LMB) is the sign bit :
        • 0  positive (+)
        • 1  negative (-)
      • Remaining bits hold absolute magnitude

Example:

210  0000 0010b

-210 1000 0010b

Q: 0000 0000 = ?

1000 0000 = ?

Try, 1000 0100b =

-410

1 s complement
1’s Complement
  • One’s Complement
    • Left most bit is the sign bit :
      • 0  positive (+)
      • 1  negative (-)
    • The magnitude is Complemented

Example:

210 0 000 0010b

-210  1 111 1101b

Exercise: try - 410using 1’s Complement

Q: 0000 0000 = ?

1111 1111 = ?

Solution:

410 = 0 0000100b

-410 =

1

1111011b

2 s complement
2’s Complement
  • 2’s Complement
    • Sign bit same as above
    • Magnitude is Complemented first and a “1” is added to the Complemented digits
    • Example:
      • 210 0 000 0010b
  • 1’s Complement  1 1111101b
      • +1
      • -210 1 111 1110b
  • Exercise: try -710using 2’s Complement
        • 710
  • 1’s Complement 
        • +1
      • -710 

0000 0111b

11111000b

  • 1111 1001b
2 s complement1
2’s Complement

710 = 0000 0111b

310 = 0000 0011b

1’s complement 1111 1100b

2’s complement 1111 1101b -310

7+(-3)  0000 0111

+ 1111 1101

  • Example: 7+(-3) [hint]: A – B = A + (~B) +1

1 1111 111 carry

  • ignore 1 0000 0100  0000 0100 410
negative numbers in binary cont
Negative Numbers in Binary (cont.)
  • Excess Representation
    • For a given fixed number of bits the range is remapped such that roughly half the numbers are negative and half are positive.

Example: (as left)

Excess – 8 notation for 4 bit numbers

    • Binary value = 8 + excess-8 value
    • MSB can be used as a sign bit, but
      • If MSB =1, positive number
      • If MSB =0, negative number
    • Excess Representation is also called bias
fundamental data types
Fundamental Data Types
  • With vs. without using sign bit
    • For a 16 bit binary pattern:
fundamental data types1
Fundamental Data Types
  • Four Data Typesin C(assume 2’s complement, byte machine)
  • Note: 27 = 128, 215 =32768, 215 = 2147483648
    • Complex and double complex are not available
acknowledgements
Acknowledgements
  • These slides where originally prepared by Dr. Jeffrey Huang, updated by Dale Roberts.