Escolar Documentos
Profissional Documentos
Cultura Documentos
Design
CHAPTER 2
Number Systems,
Operations, and
Codes
Decimal Numbers
Homework
• Example 2-1
Example 2-2
Questions
Binary Numbers
FIGURE 2-1 Illustration of a simple binary counting application.
TABLE 2–2 Binary weights.
Binary-to-Decimal Conversion
Questions
Decimal-to-Binary Conversion
• Sum-of-Weights Method
• Repeated Division-by-2 Method
Homework
• Example 2-6
Converting Decimal Fractions to
Binary
• Repeated Multiplication by 2
Questions
Binary Arithmetic
• Binary addition
• Binary subtraction
• Binary Multiplication
• Binary Division
Binary Addition
Binary Subtraction
Binary Multiplication
Binary Division
Questions
1’s Complement
• Sign bit
Left-most bit in a signed binary number is
a sign bit
A 0 sign bit indicates a +ve number and 1
sign bit indicates a –ve number
• Sign-magnitude form
• +25
• -25
1’s complement form
• 8 bits = 1 byte
• 8 bits -> 256 different numbers
• 16 bits -> 65,536
• 32 bits -> 4.295 x 109
• Formula: Total combination = 2n
• For 2’s complement signed numbers
Floating-point numbers
• Sign
• Mantissa
• Exponent
• Single-precision: 32 bits
• Double-precision: 64 bits
• Extended-precision: 80 bits
Single-precision floating-point
binary numbers
• In the mantissa or fractional part, the
binary point is understood to be 1 to
the left of the 23 bits
• Effectively there are 24 bits
• Biased exponent is obtained by adding
127 to the actual exponent
Example
Another example
Questions
Arithmetic Operations with signed
numbers
• Signed numbers
Signed magnitude form
1’s complement
2’s complement
• 2’s complement form for representing
signed numbers is the most widely
used in computers and microprocessor
based systems
Addition
• Direct Addition
Add the multiplicand a number of times equal
to the multiplier
• Partial Products
If the signs are the same, the product is
positive
If the signs are different, the product is
negative
• In multiplication, both numbers must be in
true (uncomplemented) form
Direct Addition
Partial products
Division