Binary Numbers, Pure Binary, Binary Number Conversion, Negative Binary Number
Negative Binary Number
- Finite-precision numbers to support negative binary number (fixed number of digits) - Four different systems for representing negative numbers - signed magnitude - one's complement - two's complement - excess 2m-1 (i.e. excess 128. m=8)
Sign Magnitude
- Left most bit is the sign bit: 0 is + and 1 is - - Remaining bits hold the absolute magnitude of the number *for decimal conversion, use bits other than the left most to calculate decimal number, then determine sign*
Number Representation
- Our most familiar number is the decimal number - decimal number has ten as its base - 123 = 1x102 + 2x101 + 3x100 - Radix Number Systems - base 10 in decimal is called the radix
Pure Binary
- Positional system of numeration that uses binary digits and a radix of 2 - Pure binary can be any number of binary digits to represent a whole number (integer) 1010 1100101 101100 ......... 00011
One's Complement
- Similar to sign magnitude, the left most bit is sign bit : 0 is + and 1 is - - to negate a number replace each 1 by 0 and each 0 by 1
Binary Arithmetic 2
- Subtraction? - convert subtrahend to one's or two's complement. then, add
Conversion decimal to binary
- Successive division by 2 until quotient becomes 0 - Remainder at each division becomes binary digit from right to left
Conversion binary to decimal
- Successive doubling, starting at the bottom - (binary digit) + 2 x (previous result)
excess 2m-1 (128)
- for m-bit numbers, true value plus 2m-1 - i.e. 8 bit numbers: true value v + 28-1 = v + 128 0 => 0 + 128 = 12810 = 1000 00002 -3 => -3 + 128 = 12510 = 0111 11012 * see the conversion table again to compare two's complement and excess 128 representation
Two's Complement
- the left most bit is sign bit : 0 is + and 1 is - - to negate a number.... step1: replace each 1 by 0 and each 0 by 1 step2: add 1 (if a carry occurs from the left most bit, throw it away)
Binary Number
Most Important radix for Computer Science? - 2, 8, 16 (Binary, Octal, and Hexadecimal, respectively) - Binary number has radix 2 - It has only two symbols: 0s and 1s (i.e. 1010)
Binary Arithmetic 1
add two positive numbers (0011 and 0101)