writerveggieastroprof
My Journal

Previous Entry :: Next Entry

Mood:
Hopefully As Interested In the Topic as the Students

Read/Post Comments (0)
Share on Facebook



Different Ways of Operating on Numbers

Student "edition" found at {csi dot journalspace dot com}.

Maybe I shouldn't have started this blog now, not with everything that's been going on.

In the first meeting of my Computer Architecture lecture class for the second week of the third term, we talked about the two ways that negative numbers are represented inside the computer.

The first is the sign magnitude method, where instead of using n bits to represent a number, n minus one bits are used, and the first bit is now assigned for the value’s sign, zero for positive and one for negative.

One major disadvantage of this is that for n bits which would have two raised to n possible values in unsigned integers, for signed integers, it would have one less, because there would be two representations for zero: one which has a positive sign and another of which has a negative sign.

For the operations of addition and subtraction, the magnitudes would have to be segregated first. These have to be compared to find out which is larger than the other. The sign of the larger one will now be the sign of the result.

Next, the signs have to be compared. If the signs are the same and the operation is addition, or if the signs are different and the operation is subtraction, then the sum of the magnitudes is obtained.

If the signs are the same and the operation is subtraction, or if the signs are different and the operation is addition, then the difference of the magnitudes is obtained.

It was very complicated compared to addition and subtraction of unsigned numbers.

For multiplication, the signs also had to be compared, but this time if they were the same, then the sign of the product is positive, while it is negative if the signs are different.

At this point I should have talked about overflow and underflow, when the result is bigger or smaller than the number of bits involved. In other words, it is out of range.

But I decided to put that for the next meeting and concentrated on giving the class several examples instead.

Session 939’s binary representation is negative zero. Class dismissed.


Read/Post Comments (0)

Previous Entry :: Next Entry

Back to Top

Powered by JournalScape © 2001-2010 JournalScape.com. All rights reserved.
All content rights reserved by the author.
custsupport@journalscape.com