# Representing Negative Numbers

Views:

Category: Entertainment

## Presentation Description

No description available.

## Presentation Transcript

### More on Binary!:

More on Binary! The History Interesting Facts How to Represent Negative Numbers Method 1 : Sign and Magnitude Method 2: Two’s Complement System

### Why are we learning about Binary?:

Why are we learning about Binary? Because at a very base level, that’s how computers work. They add stuff up etc….all on the basis of things being ON (1) or OFF(0) So Binary is crucial to understanding the basics of how Computers work Genetics –also important when studying the human body! (DNA…RNA…Code!)

### In the days before computers:

In the days before computers Developing processors with circuitry That performed calculations…all in binary! Note: worst illustration EVER

The questions they had to ask themselves were I want the computer to add 2+ 3 –how do I do it? First, how do I display the number 2 or 3? (in terms of 1’s and 0’s) Second how do I add these two numbers together What if I had a negative number..how would I represent that in 1’s and 0’s?

KONRAD ZUSE (1910-1995) Credited with being the inventor of the first programmable computer! Konrad Zuse builds Z1, world's first program-controlled computer. 1946: Zuse founds world's first computer startup company : the Zuse-Ingenieurbüro Hopferau. Venture capital raised through ETH Zürich and an IBM option on Zuse's patents. John Vincent Atanasoff???? died 15 June 1995. Said to have built it in the living room of his Parents apartment in BERLIN!

### Slide 6:

From http://www.idsia.ch/~juergen/zuse.html 1950: Despite having lost many years of work through the destruction of Berlin, Zuse leases world's first commercial computer (the Z4) to ETHZ, several months before the sale of the first UNIVAC.

### Zuse’s wild ideas.:

Zuse’s wild ideas. Read more about them…all his writings, and musings and thoughts etc at: http://www.zib.de/zuse/English_Version/index.html (online archive of interesting stuff he did/wrote)

### Zuse’s computer used the Binary System!:

Zuse’s computer used the Binary System! Interesting Facts Zuse was unable to convince the Nazi government to support his work for a computer based on electronic valves. The Germans thought they were close to winning the War and felt no need to support further research. Konrad Zuse wrote the first algorithmic programming language called 'Plankalkül' in 1946, which he used to program his computers. # He wrote the world's first chess-playing program using Plankalkül. The Plankalkül language included arrays and records and used a style of assignment (storing the value of an expression in a variable) in which the new value appears in the right column. An array is a collection of identically typed data items distinguished by their indices (or "subscripts"), for example written something like A[i,j,k], where A is the array name and i, j and k are the indices. Arrays are best when accessed in an unpredictable order. This is in contrast to lists, which are best when accessed sequentially.

### Another Interesting fact.:

Another Interesting fact. By 1967, the Zuse KG had built a total of 251 computers. Due to financial problems, it was then sold to Siemens . Well known company today

### Slide 13:

Claude Shannon Claude Elwood Shannon (April 30, 1916 – February 24, 2001), an American electronic engineer and mathematician , is "the father of information theory ". [1] Shannon is famous for having founded information theory with one landmark paper published in 1948. But he is also credited with founding both digital computer and digital circuit design theory in 1937, when, as a 21-year-old master's student at MIT, he wrote a thesis demonstrating that electrical application of Boolean algebra could construct and resolve any logical, numerical relationship. It has been claimed that this was the most important master's thesis of all time . [2] http://en.wikipedia.org/wiki/Claude_Shannon

### Binary!:

Binary! We’ve discussed already how to reprsent Decimal numbers as Binary numbers and vice versa. 3 in Decimal (base 10) is 011 in Binary Now…what about Arithmetic in Binary!?! What is 10010101 + 10101010?!

### Ways to represent Negative Numbers?!:

Ways to represent Negative Numbers?!

### MSB –Most Significant Bit:

MSB –Most Significant Bit 1 010101010101

### Negative numbers…..:

Negative numbers…..

### Sign and Magnitude:

Sign and Magnitude A value can be represented using SIGN and MAGNITUDE 1 bit (1 or 0) represents the SIGN of the number. 1= -1 and 0 =positive number For example: 1010 = -2 0010 = +2

### What is the disadvtange of this?:

What is the disadvtange of this? What is the maximum number it can hold? (maximum VALUE 4 bits can hold) How many digits can 4 bits hold? If there was no sign bit, what is the max number? If there was no sign bit, what is the maximum digits? For example: 1010 = -2 0010 = +2 7 15 (-7 to 7) 16 (0-15) 15 16 (0-15)

### What is the disadvtange of this?:

What is the disadvtange of this? What is the maximum number it can hold? (maximum VALUE 4 bits can hold) How many digits can 4 bits hold? If there was no sign bit, what is the max number? If there was no sign bit, what is the maximum digits? For example: 1010 = -2 0010 = +2 7 15 (-7 to 7) 15 16 (0-15)

### 4 bits can represent either:

4 bits can represent either -7, -6, -5, -4, -3, -2, -1, 0, 1, 2, 3, 4 , 5, 6, 7 -7, -6, -5, -4, -3, -2, -1, 0, 1, 2, 3, 4 , 5, 6, 7 0, 1, 2, 3, 4, 5 , 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 1111 0000 or a combination of 1’s and 0’s Without sign bit With sign bit

### 4 bits can represent either:

4 bits can represent either -7, -6, -5, -4, -3, -2, -1, 0, 1, 2, 3, 4 , 5, 6, 7 -7, -6, -5, -4, -3, -2, -1, 0, 1, 2, 3, 4 , 5, 6, 7 0, 1, 2, 3, 4, 5 , 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 1111 0000 or a combination of 1’s and 0’s With sign bit Without sign bit Can hold 16 digits Can hold only 15 digits Why can you only hold 15 digits (and not 16) When you use sign and magnitude. 8421 1111

Answer From http://scholar.hw.ac.uk/site/computing/topic17.asp?outline = Great resource for sign and magnitude and two’s complement, negative numbers etc…

### Slide 24:

http://scholar.hw.ac.uk/site/computing/topic17.asp?outline =

### Slide 25:

Here we notice that we DO NOT need an extra bit to represent the sign. In other words, 4 bits can represent -8 as well as +8 (using four bits) So there is no wastage of bits. The advantage of this system is that Positive and negative numbers can be treated in the same way.

### Read the tutorial on this site (very useful):

Read the tutorial on this site (very useful) http://scholar.hw.ac.uk/site/computing/topic18.asp?outline=no

### Converting a Binary (positive decimal equivalent) to its negative:

Converting a Binary (positive decimal equivalent) to its negative Notice the negative Is this represented Using sign and magnitude or Two’s complement?

### Why do we need to know how to convert to negative!?:

Why do we need to know how to convert to negative!?

What about Addition and Subtraction. What if you somehow went to Primary school and were taught how To ADD, but not how to subtract. How would you deal with subtracting 12 from 15?

### Assuming you knew how to deal with negative numbers:

Assuming you knew how to deal with negative numbers JOHN SMITH –CV -Addition -Knowledge of Negative Numbers -can’t subtract but have developed technique to subtract using negative numbers and addition! Picture of me

### 15-12?:

15-12? Is the same as -12+15? Negative number Addition So what has John Smith done? Converted the number to be subtracted into a negative number. Then added it!

### Computers=John Smith:

Computers=John Smith Instead of Subtracting, they just stick with addition. But for that they have to first convert the number to be subtracted into a negative number! This is why we need to know HOW to convert a number into a negative equivalent!

### Converting a two’s compliment number into DENARY:

Converting a two’s compliment number into DENARY -128 64 32 16 8 4 2 1 1 0 1 0 0 1 1 0 This equals -128 + 16 + 4 + 2 = -106 Left most bit has a negative place value.

### Next thing we need to understand..:

Next thing we need to understand.. When I type “A”…..on the keyboard. What is that character in Binary:? We know that when I type “2” that is 010 in Binary. But what is an A?

### DATA REPRESENTATION:

DATA REPRESENTATION We’re trying to figure out how to represent DATA (numbers, text, letters, symbols) in BINARY

### 1 – 001 2 - 010 3 - 011 What about the character “A”???:

1 – 001 2 - 010 3 - 011 What about the character “A”???

ASCII CHART

### Slide 39:

ASCII is an acronym for the American Standard Code for Information Interchange. It is a standard seven-bit code that was first proposed by the American National Standards Institute or ANSI in 1963, and finalized in 1968 as ANSI Standard X3.4. The purpose of ASCII was to allow compatibility between different types of data processing equipment including computers and teletype machines. According to Mary Brandel's Computer World article entitled "1963: ASCII Debuts": "To understand why ASCII is such a big deal, you have to realize that before it, different computers had no way to communicate with one another. Each manufacturer had its own way of representing letters in the alphabet, numbers and control codes... ASCII functions as a common denominator between computers that otherwise have nothing in common. It works by assigning standard numeric values to letters, numbers, punctuation marks and other characters such as control codes. An uppercase "A," for example, is represented by the number 65."

### Why is ASCII a big deal?:

Why is ASCII a big deal? "To understand why ASCII is such a big deal, you have to realize that before it, different computers had no way to communicate with one another. Each manufacturer had its own way of representing letters in the alphabet, numbers and control codes... ASCII functions as a common denominator between computers that otherwise have nothing in common. It works by assigning standard numeric values to letters, numbers, punctuation marks and other characters such as control codes. An uppercase "A," for example, is represented by the number 65."

### Slide 41:

In 1962, IBM wrote and promoted, a coding standard known as E xtended B inary- C oded- D ecimal I nterchange C ode, or EBCDIC , an eight-bit code that was a direct competitor to ASCII. However, ASCII won the standards race. Bob Bemer put the backslash into the ASCII text set. In 1981, IBM first used the standard for personal computers, before that the Univac 1050 was the computer to do so. Prior to 1981, IBM used their own EBCDIC standard.

### Someone says….:

Someone says…. I want your CV in ASCII format??

### No formatting (no bold, underline etc):

No formatting (no bold, underline etc)