Binary Arithmetic and Floating Point

38 %
63 %
Information about Binary Arithmetic and Floating Point
Education

Published on November 25, 2008

Author: MissBenjamin

Source: authorstream.com

BINARY ARITHMETIC : BINARY ARITHMETIC Binary Addition Binary Subtraction Modern Binary Number System : Modern Binary Number System The modern binary number system was fully documented by Gottfried Leibniz in the 17th century in his article Explication de l'Arithmétique Binaire. Leibniz's system used 0 and 1, like the modern binary numeral system. Slide 3: He also discovered the binary system, foundation of virtually all modern computer architectures. In philosophy, he is mostly remembered for optimism, i.e. his conclusion that our universe is, in a restricted sense, the best possible one God could have made. From Wikipedia. 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! The questions they had to ask themselves were : 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) : 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 8: 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. 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 12: 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?! Binary Addition : Binary Addition The last entry in the above table should be read as "1 + 1 = 0 with a carry of 1", analogous to the decimal system where 9 + 1 = 0 with a carry of 1 = 10. Just as we read decimal 12 to be 1 X 101 + 2 X 10 0, the last entry, "10" is to be read as "one times 21 plus 0 times 20". Recap : Recap 1 + 0 = 1 + 1 = 0 + 0 = 0+ 1 = 9+1 Recap on Converting Binary  + Decimal : Recap on Converting Binary  + Decimal 128 64 32 16 8 4 2 1 1 0 1 0 0 1 1 0 This equals 128 + 16 + 4 + 2 = 150 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. Ordinary denary subtraction : Ordinary denary subtraction 0-0= 1-0= 1-1= 0-1= Subtraction : Subtraction Now if the last column had been decimal numbers, the final entry would have been "-1", which we might have stated as "1 with a borrow of 1". Thus in binary, the last entry is to be read the same way: "1 with a borrow of 1". Note that there is no minus sign in binary. The leading 1 plays the role of a minus sign when we are dealing with signed numbers. So we can consider the number 11 to mean -1. These basic rules need not be memorized, because they are the same ones we learned in elementary school when we learned the decimal system. So it is no problem to extend our work to larger numbers: Sort of the same as ordinary denary subtraction The first one Represents a - sign The easiest way : The easiest way To subtract binary numbers 1) Convert the number to be subtracted to a negative number…and then add it. So to subtract 12 from 15 1)Convert 12 to Negative binary number 2) Add 15 (in binary to 12) Subtracting in Binary! : Subtracting in Binary! = 00001100 (in binary) -12 = 11110100 (negative) = 00001111 ________________ 00000011 add What are they!? : What are they!? Integers –whole numbers, Real Numbers –fractions or 1.10 Floating Point –a system for numerical representation of real numbers (a string of digits represents a real number –the point can float) MSB –Most Significant Bit : MSB –Most Significant Bit 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 : 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 30: http://scholar.hw.ac.uk/site/computing/topic17.asp?outline= Slide 31: 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 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!

Add a comment

Related presentations

Related pages

Floating point - Wikipedia

... IBM included IEEE-compatible binary floating-point arithmetic to its mainframes; in 2005, IBM also added IEEE-compatible decimal floating-point ...
Read more

The Floating-Point Guide - Binary Fractions

In-depth explanation of how binary fractions work, ... binary can only represent those numbers as a finite ... Binary Fractions; Floating-Point; Exact ...
Read more

IEEE floating point - Wikipedia

The IEEE Standard for Floating-Point Arithmetic ... For the exchange of binary floating-point ... which defines a total ordering for all floating numbers ...
Read more

Binary Arithmetic - Swarthmore College

Binary Arithmetic. Before going through ... Floating point arithmetic; ... the topic is developed by first considering the binary representation of ...
Read more

IEEE 754: Standard for Binary Floating-Point Arithmetic

IEEE 754-2008 governs binary floating-point arithmetic. It specifies number formats, basic operations, conversions, and exceptional conditions.
Read more

IEEE Standard 754 for Binary Floating-Point Arithmetic

Work in Progress: Lecture Notes on the Status of IEEE 754 October 1, 1997 3:36 am Page 3 IEEE 754 encodes floating ...
Read more

What Every Computer Scientist Should Know About Floating ...

Floating-point arithmetic is considered an ... number will recover the original floating-point number. Proof Binary single precision numbers ...
Read more

Tutorial: Floating-Point Binary - Kip Irvine

Tutorial: Floating-Point Binary. ... The sign of a binary floating-point number is represented by a single bit. A 1 bit indicates a negative number, ...
Read more

IEEE 754 floating point converter - h-schmidt.net

... (IEEE 754 floating point). The conversion is limited to single precision numbers (32 Bit). ... Or you can enter a binary number, ...
Read more

IEEE 754 – Wikipedia

Titel Standard for radix-independent floating-point arithmetic, ... Notes on the Status of IEEE Standard 754 for Binary Floating-Point-Arithmetic, ...
Read more