0% found this document useful (0 votes)
21 views16 pages

Understanding Decimal and Binary Numbers

The document discusses various number systems including decimal, binary, hexadecimal, and octal, explaining their structures, conversions, and arithmetic operations. It highlights the importance of weighted systems in representing numbers and provides methods for converting between these systems. Additionally, it covers the concepts of 1's and 2's complements for binary numbers and their applications in representing negative values.

Uploaded by

sm5909488
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
21 views16 pages

Understanding Decimal and Binary Numbers

The document discusses various number systems including decimal, binary, hexadecimal, and octal, explaining their structures, conversions, and arithmetic operations. It highlights the importance of weighted systems in representing numbers and provides methods for converting between these systems. Additionally, it covers the concepts of 1's and 2's complements for binary numbers and their applications in representing negative values.

Uploaded by

sm5909488
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

2-1 Decimal Numbers

• These numbers are used every day in our


daily lives
• Actually, decimal numbers is a type of
weighted system numbers
• Why??
– The position of each digit in a decimal number
indicates the magnitude of the quantity
represented and can be assigned a weight
• The weight  positive powers of ten
: : : 102 101 100
Fractional numbers in decimal
numbers
• The weights for fractional numbers in
decimal numbers are negative powers of
ten
– They decrease from left to right beginning
with 10¡1
• They are written as follows
2 1 0 ¡1 ¡2 ¡3
10 10 10 :10 10 10 :::
Decimal point
What is the meaning of weighted
number system??
• As mentioned before, each number will be
multiplied by its weight to get the actual number
• Example:
– Let’s consider 23 (in decimal number) or, in words
twenty three 101 100
23
2 3
2 £ 101 3 £ 100
2 3
23
2-2 Binary Numbers
• These types of numbers have only two
digits: 1 and 0 (bits)
• Therefore, it is less complicated compared
to decimal numbers
• The base is two and written as
(0011)2 = 310
• In general, with n bits we can count up to a
number equal to 2n ¡ 1
Application using binary numbers
• A counting system that counts tennis ball
The weighting structure of binary
numbers
• Similar to decimal numbers, binary
numbers are weighted number systems
• How the weights are structured?
– Based on powers of two, which begins with 0
– Refer to Table 2-2 for clearer picture
• Let’s look at the two examples in our text
book
2-3 Decimal-to-Binary Conversion
• After learning decimal and binary numbers,
we must be able to convert between these
two
• Decimal-to-binary conversion methods:
– Sum-of-weight method
• 9 = 8 + 1 ¡! 9 = 23 + 21 This weight
must be
– Repeated division-by-2 method
• Check page 54
Converting Decimal Fractions to
Binary
• There are two methods:
– Sum-of-weights
• 0:625 = 0:5 + 0:125 = 2¡1 + 2¡3 = 0:101
– Repeated multiplication by 2
• Let’s look at page 56
2-4 Binary Arithmetic
• There are 4 arithmetic operations using
binary
– Binary addition
– Binary subtraction
– Binary multiplication
– Binary division
• All arithmetic operations follow the same
procedure as decimal numbers have –
carry, borrow, partial products
2-5 1’s and 2’s Complements of
Binary Numbers
• These complements of binary numbers are
important because they permit the
representation of negative numbers
• How to find 1’s complement?
– By changing all 1s to 0s and all 0s to 1s
• How to find 2’s complement?
– By changing all 1s to 0s and all 0s to 1s, then add 1
to the LSB
– Alternative method to find 2’s complement
• Start with LSB and write the bits as they are up to and
including the first 1
• Take the 1’s complements of the remaining bits
Example of obtaining 2’s complement
of a negative binary number
Let’s do some exercises!!
• Section 2-5 Review
Questions
1. Determine the 1’s 00011010 11110111 10001101
complement of each 11100101 00001000 01110010
binary number:

2. Determine the 2’s 00010110 11111100 10010001


complement of each 11101010 00000100 01101111
binary number:
2-8 Hexadecimal Numbers(1)
• Hexadecimal numbers are one of the most important
numbers in digital systems, as “Assembly” language
(machine language) uses this number to program a
micro processor system
• It uses sixteen characteristics, but easy to read as each
of its 4 bits are used to represent a number between 0-
16
• Binary-to-hexadecimal conversion
• Hexadecimal-to-binary conversion
• Hexadecimal-to-decimal conversion
– Convert to binary and followed by decimal
• Decimal-to-hexadecimal conversion
2-8 Hexadecimal Numbers(2)
• Hexadecimal addition
– Use common addition method – less than 15,
write the answer in hexadecimal number, and
if >15, carry one to the next bit
• Hexadecimal subtraction
– There are three ways can be used (see next
slide)
– They are all 2’s complement
Method 1

Method 2

Method 3
2-9 Octal Numbers
• This number is composed of eight digits; 0-7
• Octal-to-decimal conversion
– Similar to others
• Decimal-to-octal conversion
– Using this following technique
• Binary-to-octal conversion
– Quite similar with binary-to-hexadecimal conversion
– If there are not enough bit (for the most left bit), add 1
or 2 zeros as 0s will never affect the binary numbers

You might also like