You are on page 1of 44

Clarence S.

Ordonia
Instructor
Chapter III

 Computer Arithmetic & Number Systems


 A computer number format is the internal
representation of numeric values in digital computer
and calculator hardware and software. Normally,
numeric values are stored as groupings of bits, named
for the number of bits that compose them.
Decimal Number System
 The number system that we use in our day-to-day life
 Decimal number system has base 10 as it uses 10 digits
from 0 to 9.
 Each position represents a specific power of the base
(10).
Binary Number System
Characteristics
 Uses two digits, 0 and 1.
 Also called base 2 number system
 Each position in a binary number represents a 0 power
of the base (2).
 Last position in a binary number represents a x power
of the base (2).
Decimal to Other Base System
Steps
 Step 1 - Divide the decimal number to be converted by the
value of the new base.
 Step 2 - Get the remainder from Step 1 as the rightmost digit
(least significant digit) of new base number.
 Step 3 - Divide the quotient of the previous divide by the new
base.
 Step 4 - Record the remainder from Step 3 as the next digit (to
the left) of the new base number.
 Repeat Steps 3 and 4, getting remainders from right to left,
until the quotient becomes zero in Step 3.
 The last remainder thus obtained will be the most significant
digit (MSD) of the new base number.
Other base system to Decimal System
Steps
 Step 1 - Determine the column (positional) value of
each digit (this depends on the position of the
digit and the base of the number system).
 Step 2 - Multiply the obtained column values (in Step
1) by the digits in the corresponding columns.
 Step 3 - Sum the products calculated in Step 2. The
total is the equivalent value in decimal
BINARY ARITHMETIC
 ADDITION
 SUBTRACTION
 MULTIPLICATION
 DIVISION
Binary Addition
Rules of Binary Addition

0+0=0
0+1=1
1+0=1
1 + 1 = 0, and carry 1 to the next more significant bit
Binary Subtraction
Rules of Binary Subtraction
0-0=0
1-0=1
1-1=0
0 - 1 = 0, with borrow 1 from the next more significant
bit = 1
Binary Multiplication
Rules of Binary Multiplication

0x0=0
0x1=0
1x0=0
1x1=1
Binary Division

*Binary division is the repeated process of subtraction,


just as in decimal division.
Number Complements

9’s & 10’s Complements

1’s & 2’s Complements


Notes:
Binary Number System
System Digits: 0 and 1
Bit (short for binary digit): A single binary digit
LSB (least significant bit): The rightmost bit
MSB (most significant bit): The leftmost bit

Binary Equivalents
1 Nybble (or nibble) = 4 bits
1 Byte = 2 nybbles = 8 bits
1 Kilobyte (KB) = 1024 bytes
1 Megabyte (MB) = 1024 kilobytes = 1,048,576 bytes
1 Gigabyte (GB) = 1024 megabytes = 1,073,741,824 bytes

Binary Number System Advocate: Gottfried Wilhelm Leibniz


Octal Number System
Characteristics
 Uses eight digits, 0,1,2,3,4,5,6,7.
 Also called base 8 number system
 Each position in a octal number represents a 0 power
of the base (8).
 Last position in a octal number represents a x power of
the base (8).

Octal Equivalence
85 84 83 82 81 80 8-1 8-2
32,768 4,096 512 64 8 1 .125 .015625
Hexadecimal Number System
Characteristics
 Uses 10 digits and 6 letters, 0,1,2,3,4,5,6,7,8,9,A,B,C,D,E,F.
 Letters represents numbers starting from 10.
 A = 10, B = 11, C = 12, D = 13, E = 14, F = 15.
 Also called base 16 number system
 Each position in a hexadecimal number represents a 0
power of the base (16).
 Last position in a hexadecimal number represents a x
power of the base (16).

Hexadecimal Equivalence
164 163 162 161 160 16-1 16-2
65,536 4096 256 16 1 0.0625 .00390625
American Standard Code for Information Interchange
(ASCII /ˈæski/ ASS-kee)
 The standard code was first proposed by the American
National Standards Institute or ANSI in 1963, and finalized in
1968 as ANSI Standard X3.4. The purpose of ASCII was to allow
compatibility between different types of data processing
equipment including computers and teletype machines.

 In 1981, IBM developed an extension of 8-bit ASCII code, called


"code page 437", in this version were replaced some obsolete
control characters for graphic characters. Also 128 characters
were added , with new symbols, signs, graphics and latin
letters, all punctuation signs and characters needed to write
texts in other languages, such as Spanish.
In this way was added the ASCII characters ranging from 128 to
255.
ASCII Oct Dec Hex Eng. Alp. & SC
0010 0001 041 33 21 !
0010 0010 042 34 22 "
0010 0111 047 39 27 '
0010 1100 054 44 2C ,
0010 1110 056 46 2E .

0011 1111 077 63 3F ?

0100 0001 101 65 41 A


0100 0010 102 66 42 B
0100 0011 103 67 43 C

0110 0001 141 97 61 a


0110 0010 142 98 62 b
0110 0011 143 99 63 c
ASCII Oct Dec Hex Eng. Alp. & SC
0010 0001 041 33 21 !
0010 0010 042 34 22 "
0010 0111 047 39 27 '
0010 1100 054 44 2C ,
0010 1110 056 46 2E .

0011 1111 077 63 3F ?

0100 0001 101 65 41 A


0100 0010 102 66 42 B
0100 0011 103 67 43 C

0110 0001 141 97 61 a


0110 0010 142 98 62 b
0110 0011 143 99 63 c
ASCII Application
Moving Information
Within the Computer
 How do binary numerals move into, out of, and within
the computer?
 Information is moved about in bytes, or multiple bytes
called words.
 Words are the fundamental units of information.
 The number of bits per word may vary per computer.
 A word length for most large IBM computers is 32 bits:
Moving Information
Within the Computer
 Bits that compose a word
are passed in parallel from
place to place.
 Ribbon cables:
 Consist of several wires,
molded together.
 One wire for each bit of
the word or byte.
 Additional wires
coordinate the activity of
moving information.
 Each wire sends
information in the form
of a voltage pulse.
Moving Information
Within the Computer
 Example of sending
the word WOW over
the ribbon cable
 Voltage pulses
corresponding
to the ASCII
codes would
pass through
the cable.
ASCII Application
Audio File Size
Formula

File size = Time (s) x Sample Rate (Hz) x Bit Depth x Number of Channels
Audio File Size
Example 1

Calculate the size of a 40 second audio file sampled at 44.1KHz using a sample
depth of 16 bit. The audio is mono.
Audio File Size
Example 1

Calculate the size of a 40 second audio file sampled at 44.1KHz using a sample
depth of 16 bit. The audio is mono.

File Size = Time x Sample Rate x Bit Depth x Channels


Audio File Size
Example 1

Calculate the size of a 40 second audio file sampled at 44.1KHz using a sample
depth of 16 bit. The audio is mono.

File Size = Time x Sample Rate x Bit Depth x Channels


Audio File Size
Example 1

Calculate the size of a 40 second audio file sampled at 44.1KHz using a sample
depth of 16 bit. The audio is mono.

File Size = 40 x 44100 x 16 x 1


= 28,224,000 bits

28,224,000 / 8 / 1024 / 1024


= 3.36 Mb
Audio File Size
Example 2

Calculate the size of a 3 minute 22 second stereo song sampled at CD quality


using a sample depth of 24 bits.
Audio File Size
Example 2

Calculate the size of a 3 minute 22 second stereo song sampled at CD quality


using a sample depth of 24 bits.

File Size = Time x Sample Rate x Bit Depth x Channels


Audio File Size
Example 2

Calculate the size of a 3 minute 22 second stereo song sampled at CD quality


using a sample depth of 24 bits.

File Size = Time x Sample Rate x Bit Depth x Channels


Audio File Size
Example 2

Calculate the size of a 3 minute 22 second stereo song sampled at CD quality


using a sample depth of 24 bits.

File Size = 202 x 44100 x 24 x 2


= 427,593,600 bits

427,593,600 / 8 / 1024 / 1024


= 50.97 Mb
Video File Size
Formula

File size = Time (s) x Frames per Second x Pixels per Frame x Bit Depth
Video File Size
Example 1

Calculate the size of an uncompressed 30 second video clip captured at 24 fps.


The video resolution is 800 x 600 with a colour depth of 16 bits.

File Size = Time x Frames per Second x Pixels per Frame x Bit Depth
Video File Size
Example 1

Calculate the size of an uncompressed 30 second video clip captured at 24 fps.


The video resolution is 800 x 600 with a colour depth of 16 bits.

File Size = Time x Frames per Second x Pixels per Frame x Bit Depth
Video File Size
Example 1

Calculate the size of an uncompressed 30 second video clip captured at 24 fps.


The video resolution is 800 x 600 with a colour depth of 16 bits.

File Size = Time x Frames per Second x Pixels per Frame x Bit Depth

= 30 x 24 x 800 x 600 x 16
= 5,529,600,000 bits

5,529,600,000 / 8 / 1024 / 1024 / 1024


= 659.18 Mb
Video File Size
Example 2

A video is captured at 25 fps and is 3 minutes 10 seconds in length. The video


resolution is 1024 x 768 pixels and each pixel is represented using 24 bits.
Assuming the video is uncompressed, what will its file size be?
Video File Size
Example 2

A video is captured at 25 fps and is 3 minutes 10 seconds in length. The video


resolution is 1024 x 768 pixels and each pixel is represented using 24 bits.
Assuming the video is uncompressed, what will its file size be?

File Size = Time x Frames per Second x Pixels per Frame x Bit Depth
Video File Size
Example 2

A video is captured at 25 fps and is 3 minutes 10 seconds in length. The video


resolution is 1024 x 768 pixels and each pixel is represented using 24 bits.
Assuming the video is uncompressed, what will its file size be?

File Size = Time x Frames per Second x Pixels per Frame x Bit Depth
Video File Size
Example 2

A video is captured at 25 fps and is 3 minutes 10 seconds in length. The video


resolution is 1024 x 768 pixels and each pixel is represented using 24 bits.
Assuming the video is uncompressed, what will its file size be?

File Size = Time x Frames per Second x Pixels per Frame x Bit Depth

= 190 x 25 x 1024 x 768 x 24


= 89,653,248,000 bits

89,653,248,000 / 8 / 1024 / 1024 / 1024


=10.44 Gb
ASSIGNMENT
1. Calculate the size of a 5 minute 09 second stereo song sampled at CD quality
using a sample depth of 24 bits.
2. Calculate the size of an uncompressed 1 hour 15 seconds video clip captured
at 32 fps. The video resolution is 800 x 600 with a colour depth of 16 bits.

You might also like