CMPT 150 Lecture Notes - Binary Number, Boolean Expression, Dispatch Table
Document Summary
With sign-magnitude encoding system, the most signi cant bit of the sequence speci es the sign: 0 if positive, 1 if negative. The remaining bits determine the magnitude of the integer. Therefore y = y + 2n 1 ( + = or ) where n is the number of bits in the codeword. Thus to convert from decimal to sign-magnitude binary, express the magnitude as an n 1 bit binary number. Then assign the appropriate sign bit as the most signi cant bit. To convert a sign-magnitude encoding to decimal, remove the most signi cant bit, and then convert the remaining n 1 bits to decimal. Set the sign according to the value of the most signi cant bit. With this system all non-negative integers are represented by their n-bit base-2 encoding. As a result all numbers from 0 to 2n 1 1 will have base-2 representations that begin with 0.