CSE231 - Lecture 2
CSE231 - Lecture 2
The value of a decimal number is the sum of the digits after each digit has been
multiplied by its weight
Sign Bit: The left-most bit in a signed binary number is the sign bit, which tells you
whether the number is positive or negative.
A 0 sign bit indicates a positive number, and a 1 sign bit indicates a negative number.
Using 8-bit signed binary number, the Using 8-bit signed binary number, the
decimal number +25 is expressed as decimal number -25 is expressed as
In the 1’s complement form, a negative number is the 1’s complement of the
corresponding positive number.
In the 2’s complement form, a negative number is the 2’s complement of the
corresponding positive number.
8-bit number for +39 is: 00100111
In the sign-magnitude form, -39 is: 10100111
In the 1’s complement form, 239 is: 11011000
In the 2’s complement form, 239 is:
For 2’s complement signed numbers, the range of values for n-bit numbers is
To represent very large integer numbers, many bits are required. There is also a problem
when numbers with both integer and fractional parts, such as 23.5618, need to be
represented. The floating-point number system, based on scientific notation, is capable
of representing very large and very small numbers without an increase in the number of
bits and also for representing numbers that have both integer and fractional
components.
A floating-point number (also known as a real number) consists of two parts plus a sign.
The mantissa is the part of a floating-point number that represents the magnitude of the
number and is between 0 and 1. The exponent is the part of a floating-point number that
represents the number of places that the decimal point (or binary point) is to be moved.
Let’s consider a decimal number which, in integer form, is 241,506,800. The mantissa is
.2415068 and the exponent is 9. The floating-point number is written as 0.2415068 × 109.
In the standard format for a single-precision binary number, the sign bit (S) is the
left-most bit, the exponent (E) includes the next eight bits, and the mantissa or
fractional part (F) includes the remaining 23 bits,
PROBLEM: Determine the binary value of the following floating-point binary number.
PROBLEM:
The basic steps in the partial products method of binary multiplication are as follows:
Step 1: Determine if the signs of the multiplicand and multiplier are the same or different.
This determines what the sign of the product will be.
Step 2: Change any negative number to true (uncomplemented) form. Because most
computers store negative numbers in 2’s complement, a 2’s complement operation is
required to get the negative number into true form.
Step 3: Starting with the least significant multiplier bit, generate the partial products.
When the multiplier bit is 1, the partial product is the same as the multiplicand.
When the multiplier bit is 0, the partial product is zero. Shift each successive partial
product one bit to the left.
Step 4: Add each successive partial product to the sum of the previous partial products to
get the final product.
Step 5: If the sign bit that was determined in step 1 is negative, take the 2’s complement of
the product. If positive, leave the product in true form. Attach the sign bit to the product.
PROBLEM: Multiply the signed binary numbers: 01010011 (multiplicand) and 11000101 (multiplier).
SOLUTION
Step 1: The sign bit of the multiplicand is 0 and the sign bit of
the multiplier is 1. The sign bit of the product will be 1
(negative).
Step 2: Take the 2’s complement of the multiplier to put it in
true form. 11000101 00111011
Step 3 and 4: The multiplication proceeds as follows. Notice
that only the magnitude bits are used in these steps.
Step 5: Since the sign of the product is a 1 as determined in
step 1, take the 2’s complement of the product.
1001100100001 0110011011111
Octal to
decimal
number
The 8421 BCD Code: The 8421 code is a type of BCD (binary coded decimal) code. Binary coded
decimal means that each decimal digit, 0 through 9, is represented by a binary code of four bits. The
designation 8421 indicates the binary weights of the four bits (23, 22, 21, 20).
Invalid Codes: You should realize that, with four bits, sixteen numbers (0000 through 1111) can be
represented but that, in the 8421 code, only ten of these are used. The six code combinations that are
not used—1010, 1011, 1100, 1101, 1110, and 1111—are invalid in the 8421 BCD code.
Applications: Digital clocks, digital thermometers, digital meters, and other devices with seven-
segment displays typically use BCD code to simplify the displaying of decimal numbers.
Logic Gates