Room 514

Classes, curriculum, education…

Representing Negative Numbers in Binary February 8, 2008

Filed under: ICE4M — mryantho @ 4:53 pm
Tags: , ,

So we know that computers use binary numbers to represent letters, symbols, etc.  But we have never looked at how we can tell if a number is negative.  There has to be a way because obviously computers use negative numbers.  And since everything is binary, we can’t just tag on a “-” sign in front of the number.  So let’s take a look.

The Plan

Ok, since we can only use 1’s and 0’s we’re going to have to use one of them to indicate that a number is negative.  Let’s decide that if the first digit is a 1 then the number is negative, if it starts with 0 then it’s positive.

That obviously assumes that we have to know how long the number is.  For example, we can agree that we are only using  3 digits for the number then 0110 would be 5, and 1110 would be -5.  Get it?  1110 is not 14 because we said we are only using 3 digits for the number portion, so the first digit represents the sign.

 Ones Complement

The above way is one method of representing negative numbers in binary.  Another method we will look at is called ones complement.

Ones complement just means reversing every bit.  Every 1 becomes 0, and every 0 becomes 1.  That’s all there is to it.  Lets see an example of finding a 4 digit ones complement number.  To convert the number -6 to binary with ones complement we simply find positive 6 in binary: 0110.  Then we just flip the bits to get 1001.  

For finding any number x in binary we can follow these steps:

  1. if x is positive, simply convert to binary
  2. if x is negative convert to the positive value of x in binary
  3. find the ones complement

One thing that’s wierd about one’s complement is that there is two values for zero.  That  is because zero can be written as all 0’s or all 1’s.

Two’s Complement

Two’s Complement is the most common way of representing negative numbers in binary.  It is similar to one’s complement but with a twist.  We just need to take the one’s complememt of the number and then add one.  Let’s see an example where we find -5.

0101 (5)

1010 (one’s complement)

1011 (add one -> becomes two’s complement)  That’s all there is to it.  One of the benefits of two’s complement is that there is only one way to have zero (unlike one’s complement.)   Here’s why: if we’re using 4 bit numbers, then zero is 000.  If we take the twos’s complement we first get 1111 then we add 1 to get 10000.  Since the carry 1 goes in to the fifth position, we ignore it because we are using 4 digit numbers.  This is called “ignoring the overflow.”

Two’s complement has another benefit and it has to do with how it handles addition; but we’ll save that for homework.

Homework

  1. Create a chart that shows all 4 digit two’s complement numbers.  Also, add it to it the positive and two’s complement of the numbers 68, 95, 236, and 313 as 8 digit binary numbers. (Knowledge)
  2. Using examples, compare how to perform addition and subtraction using both one’s complment and two’s complement numbers. (Thinking)
  3. DUE: Next class
 

There are 10 types of people in the world…. February 8, 2008

Filed under: ICE3M — mryantho @ 4:49 pm

those who understand binary and those who don’t. 

Well, just like any number system there is a way to add numbers in binary.  Binary numbers might seem a bit confusing in general, but adding them is pretty easy.  We only have to remember a few simple rules.

The Rules of Adding

The rules look at the simplest case, adding two digits together.

  1. 0 + 0 = 0, carry 0
  2. 0 + 1 = 1, carry 0
  3. 1 + 1 = 1, carry 1

Keep that in mind as you take a look at this page.  It has an animation that explains this great.

Now that you understand binary addition, you’ll have no problem completing this worksheet.  This is due by next class.

 

Ohm’s Law February 8, 2008

Filed under: ITT OYAP — mryantho @ 3:05 pm
Tags: , , , ,

Ohm’s Law helps us to understand and predict the behaviour of circuits. I have gathered some resources to help you understand Ohm’s Law, as well as solve Ohm’s Law problems. Students in the past may have had some trouble understanding Ohms Law. These resources will really help you understand the concepts of Ohm’s Law. If you are having trouble solving Ohm’s Law problems, remember that practice makes perfect.

Overall Ohms Lessonss

Start at this site: WISC. This provides a great foundation on Ohm’s Law and solving problems in circuits.

Mr. Bing’s Science on Ohms Law page is more of a quick review of Ohms Law and fomulae.

Circuit Simulation

Simple demonstration. This shows the basic interaction between voltage, current, and resistance.

This interactive site: The Ohm Zone features a circuit simulation. You can build simple serial, parallel, and combination circuits and see the changes in voltage, resistance, and current. There are even some small tutorials if you click on “The Hand.”

Resistors in Series Problems

http://www.physics.uoguelph.ca/tutorials/ohm/Q.ohm.example.series.html

Resistors in Parallel Problems

http://www.physics.uoguelph.ca/tutorials/ohm/Q.ohm.example.parallel.html

Combination Circuits Problems

http://www.physics.uoguelph.ca/tutorials/ohm/Q.ohm.intro.combo.html