Go to Content
Columbia College Chicago
IAM Wiki: Template:Binary Math
Template:Binary Math

Binary Math

OPTIONAL

Binary Math http://www.ibiblio.org/obp/electricCircuits/Digital/DIGI_2.html What can one byte (8 bits) store? 2^7 2^6 2^5 2^4 2^3 2^2 2^1 2^0 1 1 1 1 1 1 1 1 128 64 32 16 8 4 2 1 128+64+32+16+8+4+2+1 = 255

What about negative numbers? Signed Magnitude

Use the first bit as the equivalent of a +/- sign.

http://www.math.grin.edu/~rebelsky/Courses/152/97F/Readings/student-binary.html 510 in 8 bit binary 00000101

-510 in 8 bit binary Signed Magnitude 10000101 (make sure that the circuit knows you are using singed magnitude otherwise this could be interpreted as 113)


Now what can one byte (8 bits) store? +/- 2^6 2^5 2^4 2^3 2^2 2^1 2^0 0 1 1 1 1 1 1 1 + 64 32 16 8 4 2 1 64+32+16+8+4+2+1 = 127 or +/- 2^6 2^5 2^4 2^3 2^2 2^1 2^0 1 1 1 1 1 1 1 1 - 64 32 16 8 4 2 1 -64+32+16+8+4+2+1 = -127

One's Compliment

One's Compliment uses regular binary numbers to represent positive numbers. To make that number negative you just flip all the bits from 1 to 0 or 0 to 1. 510 in 8 bit binary 00000101

-510 in 8 bit binary One's Compliment 11111010

Two's Compliment

Same as One's Compliment bit add one to negative numbers 510 in 8 bit binary 00000101

-510 in 8 bit binary Two's Compliment 11111011

To figure out the sign of the answer we must check the MSB (most significant bit).If MSB is 0 number is positive, interpret normally If MSB is 1 number is negative

   * complement all bits
   * add 1
   * interpret as negative number
This page was last modified on 25 July 2007, at 03:23. This page has been accessed 823 times. About IAMMediaWiki Powered by MediaWiki