SlideShare a Scribd company logo
1 of 40
Meeting #2
Block 1 (Part 2 )
Binary data representation and computation
TM112: Introduction to Computing and
InformationTechnology
OU Materials, PPT prepared by Dr. Ahmad Mikati
1
14 October 2023 TM112-AOU
Contents
• Introduction
• 2.1 Representing integers and text in binary
• 2.2 Decimal numbers and some limitations of binary representations
• 2.3 Representing logic operations and logic circuits
• Summary
2
14 October 2023 TM112-AOU
Introduction
• This part will provide you with a basic understanding of
how computers represent and process data.
• After studying it, you will be able to compare some of the
different binary representations of data and reason about
their efficiency.
• Also, you will appreciate that sometimes a particular
representation can lead to errors (with potentially far-
reaching consequences).
3
14 October 2023 TM112-AOU
Binary logic
4
• Binary logic underpins most forms of digital technology. It was developed in
the mid-nineteenth century by George Boole.
• At the time, Boole was interested in exploring the fundamental nature of truth,
so he developed a system involving symbols – a symbolic logic – to help him
reason about truth and falsity.This system is often referred to as Boolean logic
or binary logic, and it focuses on the manipulation of 1s and 0s (1 to represent
TRUE and 0 to represent FALSE).
• When trying to understand the nature of the digital world, it is useful to know
something about the binary numbers, because binary numbers are the form in
which information is held in a computer.
• For example, 100011 can be considered as a binary number. When stored in a
computer, each digit of a binary number is referred to as a bit, which is a
contraction of the word’s binary digit.
14 October 2023 TM112-AOU
1.1 Representing integers and text in binary
• The printed symbols shown in Figure 2.1 provide
convenient representations of short and long flashes of
light or short and long bleeps of sound, which is how
Morse code is normally transmitted.
5
14 October 2023 TM112-AOU
1.1 Representing integers and text in
binary
• In any representation it is important that the symbols can
be distinguished from each other.
• Changes in electrical voltages or friction in mechanical
systems can cause random fluctuations, called noise,
which may distort how the symbol is perceived.
• In a binary system there are only two symbols, so it is
generally easier to make them different enough to be
distinguishable – for example, Morse code specifies that a
dash should be three times as long as a dot.
6
14 October 2023 TM112-AOU
Binary representation systems in
computers
• Some very early computers, such as the ENIAC
(Electronic Numerical Integrator and Computer), tried to
represent data using our usual base-10 system. So, 0 volt
was used to represent the digit 0, 1 volt to represent the
digit 1, and so on, all the way up to 9 volts to represent
the digit 9.
• Hence, a lot of circuitry was needed just in order to
distinguish between the different voltages, which took up
a lot of space and generated a lot of heat.
• The advantage of representing data in binary is that only
two ranges of voltage need to be detected.
7
14 October 2023 TM112-AOU
Number systems
We have different number systems:
• Decimal (Base 10)
• It uses 10 symbols (0, 1, 2, 3, 4, 5, 6, 7, 8 and 9).
• Binary (Base 2)
• It uses 2 symbols (0 and1).
• Octal (Base 8)
• It uses 8 symbols (0, 1, 2, 3, 4, 5, 6 and 7).
• Hexadecimal (Base 16)
• It uses 16 symbols (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E and F).
8
14 October 2023 TM112-AOU
• Decimal (Base 10) System
• The system that is used worldwide.
• It uses ten digits (0 to 9) and each column counts groups
ten times bigger than those counted in the column to its
right.
• Examples:
• 37 = 7 + 3*101
• 345 = 5 + 4*101 + 3*102
• 4621 = 1 + 2*101 + 6*102 + 4*103
9
Number systems
14 October 2023 TM112-AOU
• Octal (Base 8) System
• The system that is mostly used by computer scientist.
• It uses eight digits (0 to 7) and each column counts groups
eight times bigger than those counted in the column to its
right.
• Examples:
• 468 = 6 + 4*81 = 3810
• 1258 = 5 + 2*81 + 1*82 = 8510
10
Number systems
14 October 2023 TM112-AOU
• Hexadecimal (Base 16) System
• The system that is mostly used by computer scientist.
• It uses eight digits (0 to F) and each column counts groups
sixteen times bigger than those counted in the column to
its right. (A is equivalent to 10 in decimal,….., F is
equivalent to 16 in decimal)
• Examples:
• 4616 = 6 + 4*161 = 7010
• A516 = 5 + 10*161 = 16510
11
Number systems
14 October 2023 TM112-AOU
• Binary (Base 2) System
• The system that is used by the computer.
• It uses two digits (0 and 1) and each column counts
groups two times bigger than those counted in the
column to its right.
• Examples:
• 1102 = 0 + 1*21 + 1*22 = 610
• 11012 = 1 + 0*21 + 1*22 + 1*23 = 1310
12
Number systems
14 October 2023 TM112-AOU
• A bit is short for binary digit and refers to a 1 or a 0 stored in the
computer, while a byte is a group of eight bits that can be used to
represent numbers between 0 and 255.
• A byte looks like this:
• The largest number we can store in a byte is 11111111 = (255)10.
• The smallest number we can store in a byte is 00000000 = (0)10.
• The word size for a computer is the number of bits that the CPU of a
particular computer can handle at one time. 13
Number systems
14 October 2023 TM112-AOU
Binary to Decimal Conversion
14
To convert from binary to decimal a method known as Positional notation
can be used.The below figures illustrate the method with an example of
how to convert 100110112 to decimal.
14 October 2023 TM112-AOU
Octal to Decimal Conversion
15
• To convert from octal to decimal the following formula can be used:
Decimal Form = Ʃ(ai x 8i)
• Where, 'a' is the individual digit being converted, while 'i' is the number of
the digit counting from the right-most digit in the number, starting with 0.
• Here are two examples:
14 October 2023 TM112-AOU
Converting from Decimal to any Base
Note that the highest-order bit is the leftmost bit, and it is called the most significant bit (MSB).
On the other hand, the lowest-order bit is the rightmost bit, and it is called the least significant bit (LSB).
14 October 2023 TM112-AOU 16
Given the integer part of a decimal number, you can find the equivalent
value in any base, n, as follows:
1. Divide the number by n.
2. You will get Quotient and Remainder.The remainder will always be
less than the base n. Keep this remainder aside.
3. Use the quotient to repeat the above steps, until you get a
quotient equal to 0.
4. Now, group the remainders in order, such that the first remainder
will be the least significant bit, and the last one will be the most
significant bit.
Decimal to Binary Conversion
17
14 October 2023 TM112-AOU
Decimal to Binary Conversion
18
• One of the easy methods used to convert from decimal to binary
is comparison with descending powers of two and subtraction.
• To convert a number from binary to decimal notation, we put the
number in the table and add up the values of each place value.
• So, to convert the binary number 1001 into decimal notation, we
can use the following table
Decimal number= 8+1=9
14 October 2023 TM112-AOU
Decimal to Octal
19
The conversion of a decimal number to its octal equivalent is done by
the repeated division method.You simply divide the base 10 number by 8
and extract the remainders.
Here are two examples to illustrate this method:
14 October 2023 TM112-AOU
Representing integers in binary
Unsigned integers
• In computer-speak, an unsigned integer is an integer that is greater
than or equal to zero.
• An unsigned integer is sufficient for any purpose where a value does
not become negative – for example, a counter counting upwards
from zero.
• The number of unsigned decimal values that we can represent in
binary depends on the number of bits we have available. If there are 3
bits available, we can represent 23 = 8 values. If we want to include 0,
this means that we can encode all of the unsigned integers from 0 to
7 in three bits.
20
14 October 2023 TM112-AOU
Representing integers in binary
Unsigned integers
21
• The largest decimal value that can be represented in 3 bits is 7.
This is one less than 23 (or, in mathematical notation, 23 – 1)
because one of the 8 available codes has been used up to
represent 0.
• This scheme can be extended to systems with more bits.
• In general, if we have n bits, we can represent 2n unsigned
integers, and the largest integer that can be represented is 2n – 1.
14 October 2023 TM112-AOU
Adding unsigned integers in binary
notation
• In decimal notation, adding two positive integers is very
straightforward. The two values are added, and the sign of the result
is automatically positive.
• Similarly, if the values are represented as two unsigned integers in
binary notation, their binary values can just be added.
• So, to add two binary numbers by hand, we use the same method as
adding two decimal numbers. The numbers are written one under the
other, so that each column has the same place value. Then the digits
in each column are added, column by column from the right, carrying
digits as necessary.
22
14 October 2023 TM112-AOU
Adding unsigned integers in binary
notation
23
• To illustrate, here is the working to add the two unsigned
integers 110 and 101, where the ‘carry’ digit is shown in blue
below:
14 October 2023 TM112-AOU
Sign-magnitude representation
• So for our 3 bits, there would be 23 = 8 possible binary codes, which
could be used to encode positive and negative integers as shown in
Table 2.7.
24
Signed magnitude is the most intuitive method for representing the
unsigned numbers.
The MSB (Most Significant Bit) of a binary number is kept as the
“sign” of the number
MSB = 1: negative number
MSB = 0: positive number
The remaining bits represent the magnitude (or absolute value) of
the numeric value.
14 October 2023 TM112-AOU
Sign-magnitude representation
25
In an N bit word signed magnitude system
 1 bit is used for the sign of the number (MSB).
 N-1 bits are used for the magnitude of the number.
 The largest integer is 2N-1- 1
 The smallest integer is -(2N-1- 1)
Example: In an 8 bit word signed magnitude system give the decimal
representation of the following numbers: 00000001, 10000001
Answer:
•00000001:
-The MSB is 0:The number is positive
-The remaining 7 bits are: 00000012 = 110
-The decimal number is +1
•10000001:
-The MSB is 1:The number is negative
-The remaining 7 bits are: 00000012 = 110
-The decimal number is -1
14 October 2023 TM112-AOU
Representing text in binary
• Most modern systems for encoding text derive in part from ASCII
(American Standard Code for Information Interchange, pronounced
‘askee’), which was developed in 1963.
• In the original ASCII system, upper-case and lower-case letters,
numbers, punctuation and other symbols and control codes (such as
a carriage return, backspace and tab) were encoded in 7 bits. As
computers based on multiples of 8 bits (or a byte) became more
common, the encoding system became an 8-bit system, and so could
be expanded to include more symbols.
• When binary numbers were assigned to each character in the original
ASCII system, careful thought was given to choosing sequences of
values for the characters of the alphabet and numerals that would
make it easy for a computer processor to perform common
operations on them. (These encodings were preserved in the 8-bit
system by simply padding out the leftmost bit with a 0.)
26
14 October 2023 TM112-AOU
1.1.5 Representing text in binary
• Since 2007, the standard encoding system for characters has been
Unicode Transformation Format-8 (UTF-8) which uses a variable
number of bytes (up to 6) to encode characters in use across the
world. However, in order to maintain backward compatibility, the
original 127 ASCII codes are preserved in UTF-8.
27
14 October 2023 TM112-AOU
Floating-point numbers and scientific
notation
• Consider the decimal number 2343.56.We could also write this as
23.4356 × 102 OR 0.234356 × 104 or 234356.0 × 10–2.
• The decimal point can ‘float’ to any position as long as the power of
10 is appropriate.
• Scientific notation is a special case of floating-point notation where
there is a single non-zero digit between 1 and 9 (inclusive) to the left
of the decimal point.
• To express a number greater than 10 in scientific notation, the first
stage is to divide it repeatedly by 10 until it is reduced to a number
that is less than 10.
28
14 October 2023 TM112-AOU
Floating-point numbers and scientific
notation
29
• So, the number 2343.56 can be represented in scientific notation
as 2.34356 × 103. Note that the exponent, 3, indicates that the
decimal point should be moved three places to the right to get
back the original decimal notation.
• Expressing a small number – between 0 and 1 – in scientific notation
involves a process very similar to that for large numbers.
• Take –0.000654 as an example. First you move the decimal point to the
right until it sits after the first non-zero digit: - 00006.54
• Then multiply this number by 10 raised to the power of minus the
number of places the decimal point has been moved:-6.54 × 10−4
14 October 2023 TM112-AOU
Floating-point numbers and scientific
notation
• The number –0.000654 in decimal notation can be written as -
6.54 × 10–4 in scientific notation. Here, the negative exponent (–4)
indicates that the decimal point should be moved 4 places to the left
to get back to the original decimal notation.
• Notice that scientific notation has three distinct parts, shown in
Figure 1.10:
• a sign
• an exponent (the power of 10)
• a mantissa (the decimal number part).
30
14 October 2023 TM112-AOU
Representing logic operations and
logic circuits
• In the previous two sections, we have seen that we can use binary
encodings to represent numerical and textual data.We will now see
that operations, including arithmetical operations such as addition,
and comparison operations such as less than and equals, can be
encoded as one or more logic operations.These logic operations act
on the binary representations of the data.
• To move from the human to the computer view, the integers have to
be encoded as binary representations and the addition operator has
to be encoded as a sequence of logical operations that have what is
called the truth table.
31
14 October 2023 TM112-AOU
Representing logic operations and
logic circuits
• A truth table for a logic operation lists all the possible combinations
of input values, and for each possibility gives the output value for
that operation.As the operations we will consider will always be
applied to binary encodings, each input value must be either a 1 or a
0 and the result of the operation must also always be a 1 or a 0.
• We will start by looking at the truth tables for three of the
fundamental logical operations defined by Boole.We will then see
how these basic operations can be used as building blocks for the
logic circuits that perform more complex operations. By the end of
this subsection, you will see how these simple operations can be used
to build a logic circuit to add two binary numbers.
32
14 October 2023 TM112-AOU
Representing logic operations and
logic circuits
The NOT operation
• One of the most fundamental operations we might want to perform is
to ‘flip’ a single bit – let’s call the bit a. So, if 𝒙is 1, we want the result
to be 0, and if 𝒙is 0, we want the result to be 1.This operation is called
NOT 𝒙and is expressed as: 𝒙 or 𝒙’.
33
The behavior of NOT operator is characterized by the truth table
shown below:
The NOT truth table
To physically perform logic operations on binary
data in a computer, we need to use electrical
components. The components that represent the
most fundamental operations are called logic
gates, which can be combined in a logic circuit
in order to create more complex operations.
The NOT logic gate
14 October 2023 TM112-AOU
1.3 Representing logic operations and
logic circuits
• The AND operation
• Most logical operations involve two input values.A truth table for
two binary inputs, x and y, has more rows because there are four
possible permutations (or ways of combining) the two input values,
as shown inTable 2.19.
AND logic gate
AND truth table
34
14 October 2023 TM112-AOU
Representing logic operations and
logic circuits
• The OR operation
• truth table for the logic operationOR (which Boole originally
designated by the symbol +) is shown below
OR logic gate
OR truth table
35
14 October 2023 TM112-AOU
Building logic circuits
• Suppose we want to build a logic circuit with two inputs,A and B,
that tests if B is greater than A.
• The first step is to create a truth table showing the desired
outcomes: if B is greater than A, the result is 1 (True), otherwise the
result is 0 (False).
36
14 October 2023 TM112-AOU
Building logic circuits
• To translate this into a logic expression – that is a combination of our
logic operations (NOT,AND and OR) – we follow this algorithm.
• Identify the row where the outcome (B > A) is 1.
• If inputA is 1, write A; otherwise write NOT A in the logic expression for
the selected row.
• If input B is 1, write B; otherwise write NOT B in the logic expression for
the selected row.
• Join these with anAND, and the final equation will be the sum of all the
deduced logic expressions.
37
Final equation: A’. B
14 October 2023 TM112-AOU
Building logic circuits
• Here, the resulting logic expression NOTA AND B tells us that the
logic circuit that is equivalent to this truth table for each combination
of inputs can be constructed from two logic gates
• a NOT gate withA as an input, which gives an output of NOTA
• an AND gate that takes NOT A and B as inputs, which gives the
required result NOTA AND B as an output.
38
14 October 2023 TM112-AOU
Building logic circuits
39
In the above circuit:
The output of gate 1 is: 𝒙 + 𝒚
The output of gate 2 is: 𝒚 + 𝒛
The output of gate 3 is: 𝒙 + 𝒚 ( 𝒚 + 𝒛)
14 October 2023 TM112-AOU
What is inside a logic gate?
• How Logic gates are actually constructed , and what exactly is inside a
logic gate?
• A Logic gate is itself made up of a combination of more fundamental
components that act as on/off switches.
• In early computers, such devices were generally based on various
designs of vacuum tube (collectively called valves).
• In modern computers, they are based on transistors, which are
formed of layers of semiconducting material such as silicon.
40
A ‘pluggable’ unit made of valves from
an IBM computer of the mid-1950s
A chip containing six inverters
14 October 2023 TM112-AOU

More Related Content

Similar to TM112 Meeting2-Binary data representation.pptx

Topic 1 Data Representation
Topic 1 Data RepresentationTopic 1 Data Representation
Topic 1 Data Representation
ekul
 
Week 4-Number Systems.pptx
Week 4-Number Systems.pptxWeek 4-Number Systems.pptx
Week 4-Number Systems.pptx
HamnaKhalid25
 

Similar to TM112 Meeting2-Binary data representation.pptx (20)

Data repersentation.
Data repersentation.Data repersentation.
Data repersentation.
 
Data representation in computers
Data representation in computersData representation in computers
Data representation in computers
 
Digital Electronics Notes.pdf
Digital Electronics Notes.pdfDigital Electronics Notes.pdf
Digital Electronics Notes.pdf
 
Number system
Number system Number system
Number system
 
5a data representation
5a   data representation5a   data representation
5a data representation
 
Digital Logic
Digital LogicDigital Logic
Digital Logic
 
04 chapter03 02_numbers_systems_student_version_fa16
04 chapter03 02_numbers_systems_student_version_fa1604 chapter03 02_numbers_systems_student_version_fa16
04 chapter03 02_numbers_systems_student_version_fa16
 
Topic 1 Data Representation
Topic 1 Data RepresentationTopic 1 Data Representation
Topic 1 Data Representation
 
Topic 1 Data Representation
Topic 1 Data RepresentationTopic 1 Data Representation
Topic 1 Data Representation
 
data representation
 data representation data representation
data representation
 
Computer data representation (integers, floating-point numbers, text, images,...
Computer data representation (integers, floating-point numbers, text, images,...Computer data representation (integers, floating-point numbers, text, images,...
Computer data representation (integers, floating-point numbers, text, images,...
 
Number System and Boolean Algebra
Number System and Boolean AlgebraNumber System and Boolean Algebra
Number System and Boolean Algebra
 
Week 4-Number Systems.pptx
Week 4-Number Systems.pptxWeek 4-Number Systems.pptx
Week 4-Number Systems.pptx
 
Number system computer fundamental
 Number  system computer fundamental  Number  system computer fundamental
Number system computer fundamental
 
digital logic design number system
digital logic design number systemdigital logic design number system
digital logic design number system
 
Computer Oraganizaation.pptx
Computer Oraganizaation.pptxComputer Oraganizaation.pptx
Computer Oraganizaation.pptx
 
Computer Number system
Computer Number systemComputer Number system
Computer Number system
 
numbersystem-211022083557.pdf
numbersystem-211022083557.pdfnumbersystem-211022083557.pdf
numbersystem-211022083557.pdf
 
1.1.1 binary systems By Zak
1.1.1 binary systems By Zak1.1.1 binary systems By Zak
1.1.1 binary systems By Zak
 
Digital Electronics & Fundamental of Microprocessor-I
Digital Electronics & Fundamental of Microprocessor-IDigital Electronics & Fundamental of Microprocessor-I
Digital Electronics & Fundamental of Microprocessor-I
 

Recently uploaded

Creating an Income Statement with Forecasts: A Simple Guide and Free Excel Te...
Creating an Income Statement with Forecasts: A Simple Guide and Free Excel Te...Creating an Income Statement with Forecasts: A Simple Guide and Free Excel Te...
Creating an Income Statement with Forecasts: A Simple Guide and Free Excel Te...
Aurelien Domont, MBA
 
NewBase 17 May 2024 Energy News issue - 1725 by Khaled Al Awadi_compresse...
NewBase   17 May  2024  Energy News issue - 1725 by Khaled Al Awadi_compresse...NewBase   17 May  2024  Energy News issue - 1725 by Khaled Al Awadi_compresse...
NewBase 17 May 2024 Energy News issue - 1725 by Khaled Al Awadi_compresse...
Khaled Al Awadi
 
一比一原版(USYD毕业证书)悉尼大学毕业证原件一模一样
一比一原版(USYD毕业证书)悉尼大学毕业证原件一模一样一比一原版(USYD毕业证书)悉尼大学毕业证原件一模一样
一比一原版(USYD毕业证书)悉尼大学毕业证原件一模一样
AS
 
Jual Obat Aborsi Di Sibolga wa 0851/7541/5434 Cytotec Misoprostol 200mcg Pfizer
Jual Obat Aborsi Di Sibolga wa 0851/7541/5434 Cytotec Misoprostol 200mcg PfizerJual Obat Aborsi Di Sibolga wa 0851/7541/5434 Cytotec Misoprostol 200mcg Pfizer
Jual Obat Aborsi Di Sibolga wa 0851/7541/5434 Cytotec Misoprostol 200mcg Pfizer
Pusat Herbal Resmi BPOM
 
Obat Aborsi Pasuruan 0851\7696\3835 Jual Obat Cytotec Di Pasuruan
Obat Aborsi Pasuruan 0851\7696\3835 Jual Obat Cytotec Di PasuruanObat Aborsi Pasuruan 0851\7696\3835 Jual Obat Cytotec Di Pasuruan
Obat Aborsi Pasuruan 0851\7696\3835 Jual Obat Cytotec Di Pasuruan
Obat Aborsi Jakarta Wa 085176963835 Apotek Jual Obat Cytotec Di Jakarta
 

Recently uploaded (20)

Blinkit: Revolutionizing the On-Demand Grocery Delivery Service.pptx
Blinkit: Revolutionizing the On-Demand Grocery Delivery Service.pptxBlinkit: Revolutionizing the On-Demand Grocery Delivery Service.pptx
Blinkit: Revolutionizing the On-Demand Grocery Delivery Service.pptx
 
WAM Corporate Presentation May 2024_w.pdf
WAM Corporate Presentation May 2024_w.pdfWAM Corporate Presentation May 2024_w.pdf
WAM Corporate Presentation May 2024_w.pdf
 
Beyond Numbers A Holistic Approach to Forensic Accounting
Beyond Numbers A Holistic Approach to Forensic AccountingBeyond Numbers A Holistic Approach to Forensic Accounting
Beyond Numbers A Holistic Approach to Forensic Accounting
 
Understanding Financial Accounting 3rd Canadian Edition by Christopher D. Bur...
Understanding Financial Accounting 3rd Canadian Edition by Christopher D. Bur...Understanding Financial Accounting 3rd Canadian Edition by Christopher D. Bur...
Understanding Financial Accounting 3rd Canadian Edition by Christopher D. Bur...
 
Pay after result spell caster (,$+27834335081)@ bring back lost lover same da...
Pay after result spell caster (,$+27834335081)@ bring back lost lover same da...Pay after result spell caster (,$+27834335081)@ bring back lost lover same da...
Pay after result spell caster (,$+27834335081)@ bring back lost lover same da...
 
Creating an Income Statement with Forecasts: A Simple Guide and Free Excel Te...
Creating an Income Statement with Forecasts: A Simple Guide and Free Excel Te...Creating an Income Statement with Forecasts: A Simple Guide and Free Excel Te...
Creating an Income Statement with Forecasts: A Simple Guide and Free Excel Te...
 
Global Internal Audit Standards 2024.pdf
Global Internal Audit Standards 2024.pdfGlobal Internal Audit Standards 2024.pdf
Global Internal Audit Standards 2024.pdf
 
Progress Report - UKG Analyst Summit 2024 - A lot to do - Good Progress1-1.pdf
Progress Report - UKG Analyst Summit 2024 - A lot to do - Good Progress1-1.pdfProgress Report - UKG Analyst Summit 2024 - A lot to do - Good Progress1-1.pdf
Progress Report - UKG Analyst Summit 2024 - A lot to do - Good Progress1-1.pdf
 
Pitch Deck Teardown: Goodcarbon's $5.5m Seed deck
Pitch Deck Teardown: Goodcarbon's $5.5m Seed deckPitch Deck Teardown: Goodcarbon's $5.5m Seed deck
Pitch Deck Teardown: Goodcarbon's $5.5m Seed deck
 
High Profile Bangalore Just VIP Brigade Road 100% Genuine at your Door Step
High Profile Bangalore Just VIP Brigade Road 100% Genuine at your Door StepHigh Profile Bangalore Just VIP Brigade Road 100% Genuine at your Door Step
High Profile Bangalore Just VIP Brigade Road 100% Genuine at your Door Step
 
Goal Presentation_NEW EMPLOYEE_NETAPS FOUNDATION.pptx
Goal Presentation_NEW EMPLOYEE_NETAPS FOUNDATION.pptxGoal Presentation_NEW EMPLOYEE_NETAPS FOUNDATION.pptx
Goal Presentation_NEW EMPLOYEE_NETAPS FOUNDATION.pptx
 
NewBase 17 May 2024 Energy News issue - 1725 by Khaled Al Awadi_compresse...
NewBase   17 May  2024  Energy News issue - 1725 by Khaled Al Awadi_compresse...NewBase   17 May  2024  Energy News issue - 1725 by Khaled Al Awadi_compresse...
NewBase 17 May 2024 Energy News issue - 1725 by Khaled Al Awadi_compresse...
 
一比一原版(USYD毕业证书)悉尼大学毕业证原件一模一样
一比一原版(USYD毕业证书)悉尼大学毕业证原件一模一样一比一原版(USYD毕业证书)悉尼大学毕业证原件一模一样
一比一原版(USYD毕业证书)悉尼大学毕业证原件一模一样
 
Most Visionary Leaders in Cloud Revolution, Shaping Tech’s Next Era - 2024 (2...
Most Visionary Leaders in Cloud Revolution, Shaping Tech’s Next Era - 2024 (2...Most Visionary Leaders in Cloud Revolution, Shaping Tech’s Next Era - 2024 (2...
Most Visionary Leaders in Cloud Revolution, Shaping Tech’s Next Era - 2024 (2...
 
Jual Obat Aborsi Di Sibolga wa 0851/7541/5434 Cytotec Misoprostol 200mcg Pfizer
Jual Obat Aborsi Di Sibolga wa 0851/7541/5434 Cytotec Misoprostol 200mcg PfizerJual Obat Aborsi Di Sibolga wa 0851/7541/5434 Cytotec Misoprostol 200mcg Pfizer
Jual Obat Aborsi Di Sibolga wa 0851/7541/5434 Cytotec Misoprostol 200mcg Pfizer
 
wagamamaLab presentation @MIT 20240509 IRODORI
wagamamaLab presentation @MIT 20240509 IRODORIwagamamaLab presentation @MIT 20240509 IRODORI
wagamamaLab presentation @MIT 20240509 IRODORI
 
Obat Aborsi Pasuruan 0851\7696\3835 Jual Obat Cytotec Di Pasuruan
Obat Aborsi Pasuruan 0851\7696\3835 Jual Obat Cytotec Di PasuruanObat Aborsi Pasuruan 0851\7696\3835 Jual Obat Cytotec Di Pasuruan
Obat Aborsi Pasuruan 0851\7696\3835 Jual Obat Cytotec Di Pasuruan
 
First Time Home Buyer's Guide - KM Realty Group LLC
First Time Home Buyer's Guide - KM Realty Group LLCFirst Time Home Buyer's Guide - KM Realty Group LLC
First Time Home Buyer's Guide - KM Realty Group LLC
 
Moradia Isolada com Logradouro; Detached house with patio in Penacova
Moradia Isolada com Logradouro; Detached house with patio in PenacovaMoradia Isolada com Logradouro; Detached house with patio in Penacova
Moradia Isolada com Logradouro; Detached house with patio in Penacova
 
The Art of Decision-Making: Navigating Complexity and Uncertainty
The Art of Decision-Making: Navigating Complexity and UncertaintyThe Art of Decision-Making: Navigating Complexity and Uncertainty
The Art of Decision-Making: Navigating Complexity and Uncertainty
 

TM112 Meeting2-Binary data representation.pptx

  • 1. Meeting #2 Block 1 (Part 2 ) Binary data representation and computation TM112: Introduction to Computing and InformationTechnology OU Materials, PPT prepared by Dr. Ahmad Mikati 1 14 October 2023 TM112-AOU
  • 2. Contents • Introduction • 2.1 Representing integers and text in binary • 2.2 Decimal numbers and some limitations of binary representations • 2.3 Representing logic operations and logic circuits • Summary 2 14 October 2023 TM112-AOU
  • 3. Introduction • This part will provide you with a basic understanding of how computers represent and process data. • After studying it, you will be able to compare some of the different binary representations of data and reason about their efficiency. • Also, you will appreciate that sometimes a particular representation can lead to errors (with potentially far- reaching consequences). 3 14 October 2023 TM112-AOU
  • 4. Binary logic 4 • Binary logic underpins most forms of digital technology. It was developed in the mid-nineteenth century by George Boole. • At the time, Boole was interested in exploring the fundamental nature of truth, so he developed a system involving symbols – a symbolic logic – to help him reason about truth and falsity.This system is often referred to as Boolean logic or binary logic, and it focuses on the manipulation of 1s and 0s (1 to represent TRUE and 0 to represent FALSE). • When trying to understand the nature of the digital world, it is useful to know something about the binary numbers, because binary numbers are the form in which information is held in a computer. • For example, 100011 can be considered as a binary number. When stored in a computer, each digit of a binary number is referred to as a bit, which is a contraction of the word’s binary digit. 14 October 2023 TM112-AOU
  • 5. 1.1 Representing integers and text in binary • The printed symbols shown in Figure 2.1 provide convenient representations of short and long flashes of light or short and long bleeps of sound, which is how Morse code is normally transmitted. 5 14 October 2023 TM112-AOU
  • 6. 1.1 Representing integers and text in binary • In any representation it is important that the symbols can be distinguished from each other. • Changes in electrical voltages or friction in mechanical systems can cause random fluctuations, called noise, which may distort how the symbol is perceived. • In a binary system there are only two symbols, so it is generally easier to make them different enough to be distinguishable – for example, Morse code specifies that a dash should be three times as long as a dot. 6 14 October 2023 TM112-AOU
  • 7. Binary representation systems in computers • Some very early computers, such as the ENIAC (Electronic Numerical Integrator and Computer), tried to represent data using our usual base-10 system. So, 0 volt was used to represent the digit 0, 1 volt to represent the digit 1, and so on, all the way up to 9 volts to represent the digit 9. • Hence, a lot of circuitry was needed just in order to distinguish between the different voltages, which took up a lot of space and generated a lot of heat. • The advantage of representing data in binary is that only two ranges of voltage need to be detected. 7 14 October 2023 TM112-AOU
  • 8. Number systems We have different number systems: • Decimal (Base 10) • It uses 10 symbols (0, 1, 2, 3, 4, 5, 6, 7, 8 and 9). • Binary (Base 2) • It uses 2 symbols (0 and1). • Octal (Base 8) • It uses 8 symbols (0, 1, 2, 3, 4, 5, 6 and 7). • Hexadecimal (Base 16) • It uses 16 symbols (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E and F). 8 14 October 2023 TM112-AOU
  • 9. • Decimal (Base 10) System • The system that is used worldwide. • It uses ten digits (0 to 9) and each column counts groups ten times bigger than those counted in the column to its right. • Examples: • 37 = 7 + 3*101 • 345 = 5 + 4*101 + 3*102 • 4621 = 1 + 2*101 + 6*102 + 4*103 9 Number systems 14 October 2023 TM112-AOU
  • 10. • Octal (Base 8) System • The system that is mostly used by computer scientist. • It uses eight digits (0 to 7) and each column counts groups eight times bigger than those counted in the column to its right. • Examples: • 468 = 6 + 4*81 = 3810 • 1258 = 5 + 2*81 + 1*82 = 8510 10 Number systems 14 October 2023 TM112-AOU
  • 11. • Hexadecimal (Base 16) System • The system that is mostly used by computer scientist. • It uses eight digits (0 to F) and each column counts groups sixteen times bigger than those counted in the column to its right. (A is equivalent to 10 in decimal,….., F is equivalent to 16 in decimal) • Examples: • 4616 = 6 + 4*161 = 7010 • A516 = 5 + 10*161 = 16510 11 Number systems 14 October 2023 TM112-AOU
  • 12. • Binary (Base 2) System • The system that is used by the computer. • It uses two digits (0 and 1) and each column counts groups two times bigger than those counted in the column to its right. • Examples: • 1102 = 0 + 1*21 + 1*22 = 610 • 11012 = 1 + 0*21 + 1*22 + 1*23 = 1310 12 Number systems 14 October 2023 TM112-AOU
  • 13. • A bit is short for binary digit and refers to a 1 or a 0 stored in the computer, while a byte is a group of eight bits that can be used to represent numbers between 0 and 255. • A byte looks like this: • The largest number we can store in a byte is 11111111 = (255)10. • The smallest number we can store in a byte is 00000000 = (0)10. • The word size for a computer is the number of bits that the CPU of a particular computer can handle at one time. 13 Number systems 14 October 2023 TM112-AOU
  • 14. Binary to Decimal Conversion 14 To convert from binary to decimal a method known as Positional notation can be used.The below figures illustrate the method with an example of how to convert 100110112 to decimal. 14 October 2023 TM112-AOU
  • 15. Octal to Decimal Conversion 15 • To convert from octal to decimal the following formula can be used: Decimal Form = Ʃ(ai x 8i) • Where, 'a' is the individual digit being converted, while 'i' is the number of the digit counting from the right-most digit in the number, starting with 0. • Here are two examples: 14 October 2023 TM112-AOU
  • 16. Converting from Decimal to any Base Note that the highest-order bit is the leftmost bit, and it is called the most significant bit (MSB). On the other hand, the lowest-order bit is the rightmost bit, and it is called the least significant bit (LSB). 14 October 2023 TM112-AOU 16 Given the integer part of a decimal number, you can find the equivalent value in any base, n, as follows: 1. Divide the number by n. 2. You will get Quotient and Remainder.The remainder will always be less than the base n. Keep this remainder aside. 3. Use the quotient to repeat the above steps, until you get a quotient equal to 0. 4. Now, group the remainders in order, such that the first remainder will be the least significant bit, and the last one will be the most significant bit.
  • 17. Decimal to Binary Conversion 17 14 October 2023 TM112-AOU
  • 18. Decimal to Binary Conversion 18 • One of the easy methods used to convert from decimal to binary is comparison with descending powers of two and subtraction. • To convert a number from binary to decimal notation, we put the number in the table and add up the values of each place value. • So, to convert the binary number 1001 into decimal notation, we can use the following table Decimal number= 8+1=9 14 October 2023 TM112-AOU
  • 19. Decimal to Octal 19 The conversion of a decimal number to its octal equivalent is done by the repeated division method.You simply divide the base 10 number by 8 and extract the remainders. Here are two examples to illustrate this method: 14 October 2023 TM112-AOU
  • 20. Representing integers in binary Unsigned integers • In computer-speak, an unsigned integer is an integer that is greater than or equal to zero. • An unsigned integer is sufficient for any purpose where a value does not become negative – for example, a counter counting upwards from zero. • The number of unsigned decimal values that we can represent in binary depends on the number of bits we have available. If there are 3 bits available, we can represent 23 = 8 values. If we want to include 0, this means that we can encode all of the unsigned integers from 0 to 7 in three bits. 20 14 October 2023 TM112-AOU
  • 21. Representing integers in binary Unsigned integers 21 • The largest decimal value that can be represented in 3 bits is 7. This is one less than 23 (or, in mathematical notation, 23 – 1) because one of the 8 available codes has been used up to represent 0. • This scheme can be extended to systems with more bits. • In general, if we have n bits, we can represent 2n unsigned integers, and the largest integer that can be represented is 2n – 1. 14 October 2023 TM112-AOU
  • 22. Adding unsigned integers in binary notation • In decimal notation, adding two positive integers is very straightforward. The two values are added, and the sign of the result is automatically positive. • Similarly, if the values are represented as two unsigned integers in binary notation, their binary values can just be added. • So, to add two binary numbers by hand, we use the same method as adding two decimal numbers. The numbers are written one under the other, so that each column has the same place value. Then the digits in each column are added, column by column from the right, carrying digits as necessary. 22 14 October 2023 TM112-AOU
  • 23. Adding unsigned integers in binary notation 23 • To illustrate, here is the working to add the two unsigned integers 110 and 101, where the ‘carry’ digit is shown in blue below: 14 October 2023 TM112-AOU
  • 24. Sign-magnitude representation • So for our 3 bits, there would be 23 = 8 possible binary codes, which could be used to encode positive and negative integers as shown in Table 2.7. 24 Signed magnitude is the most intuitive method for representing the unsigned numbers. The MSB (Most Significant Bit) of a binary number is kept as the “sign” of the number MSB = 1: negative number MSB = 0: positive number The remaining bits represent the magnitude (or absolute value) of the numeric value. 14 October 2023 TM112-AOU
  • 25. Sign-magnitude representation 25 In an N bit word signed magnitude system  1 bit is used for the sign of the number (MSB).  N-1 bits are used for the magnitude of the number.  The largest integer is 2N-1- 1  The smallest integer is -(2N-1- 1) Example: In an 8 bit word signed magnitude system give the decimal representation of the following numbers: 00000001, 10000001 Answer: •00000001: -The MSB is 0:The number is positive -The remaining 7 bits are: 00000012 = 110 -The decimal number is +1 •10000001: -The MSB is 1:The number is negative -The remaining 7 bits are: 00000012 = 110 -The decimal number is -1 14 October 2023 TM112-AOU
  • 26. Representing text in binary • Most modern systems for encoding text derive in part from ASCII (American Standard Code for Information Interchange, pronounced ‘askee’), which was developed in 1963. • In the original ASCII system, upper-case and lower-case letters, numbers, punctuation and other symbols and control codes (such as a carriage return, backspace and tab) were encoded in 7 bits. As computers based on multiples of 8 bits (or a byte) became more common, the encoding system became an 8-bit system, and so could be expanded to include more symbols. • When binary numbers were assigned to each character in the original ASCII system, careful thought was given to choosing sequences of values for the characters of the alphabet and numerals that would make it easy for a computer processor to perform common operations on them. (These encodings were preserved in the 8-bit system by simply padding out the leftmost bit with a 0.) 26 14 October 2023 TM112-AOU
  • 27. 1.1.5 Representing text in binary • Since 2007, the standard encoding system for characters has been Unicode Transformation Format-8 (UTF-8) which uses a variable number of bytes (up to 6) to encode characters in use across the world. However, in order to maintain backward compatibility, the original 127 ASCII codes are preserved in UTF-8. 27 14 October 2023 TM112-AOU
  • 28. Floating-point numbers and scientific notation • Consider the decimal number 2343.56.We could also write this as 23.4356 × 102 OR 0.234356 × 104 or 234356.0 × 10–2. • The decimal point can ‘float’ to any position as long as the power of 10 is appropriate. • Scientific notation is a special case of floating-point notation where there is a single non-zero digit between 1 and 9 (inclusive) to the left of the decimal point. • To express a number greater than 10 in scientific notation, the first stage is to divide it repeatedly by 10 until it is reduced to a number that is less than 10. 28 14 October 2023 TM112-AOU
  • 29. Floating-point numbers and scientific notation 29 • So, the number 2343.56 can be represented in scientific notation as 2.34356 × 103. Note that the exponent, 3, indicates that the decimal point should be moved three places to the right to get back the original decimal notation. • Expressing a small number – between 0 and 1 – in scientific notation involves a process very similar to that for large numbers. • Take –0.000654 as an example. First you move the decimal point to the right until it sits after the first non-zero digit: - 00006.54 • Then multiply this number by 10 raised to the power of minus the number of places the decimal point has been moved:-6.54 × 10−4 14 October 2023 TM112-AOU
  • 30. Floating-point numbers and scientific notation • The number –0.000654 in decimal notation can be written as - 6.54 × 10–4 in scientific notation. Here, the negative exponent (–4) indicates that the decimal point should be moved 4 places to the left to get back to the original decimal notation. • Notice that scientific notation has three distinct parts, shown in Figure 1.10: • a sign • an exponent (the power of 10) • a mantissa (the decimal number part). 30 14 October 2023 TM112-AOU
  • 31. Representing logic operations and logic circuits • In the previous two sections, we have seen that we can use binary encodings to represent numerical and textual data.We will now see that operations, including arithmetical operations such as addition, and comparison operations such as less than and equals, can be encoded as one or more logic operations.These logic operations act on the binary representations of the data. • To move from the human to the computer view, the integers have to be encoded as binary representations and the addition operator has to be encoded as a sequence of logical operations that have what is called the truth table. 31 14 October 2023 TM112-AOU
  • 32. Representing logic operations and logic circuits • A truth table for a logic operation lists all the possible combinations of input values, and for each possibility gives the output value for that operation.As the operations we will consider will always be applied to binary encodings, each input value must be either a 1 or a 0 and the result of the operation must also always be a 1 or a 0. • We will start by looking at the truth tables for three of the fundamental logical operations defined by Boole.We will then see how these basic operations can be used as building blocks for the logic circuits that perform more complex operations. By the end of this subsection, you will see how these simple operations can be used to build a logic circuit to add two binary numbers. 32 14 October 2023 TM112-AOU
  • 33. Representing logic operations and logic circuits The NOT operation • One of the most fundamental operations we might want to perform is to ‘flip’ a single bit – let’s call the bit a. So, if 𝒙is 1, we want the result to be 0, and if 𝒙is 0, we want the result to be 1.This operation is called NOT 𝒙and is expressed as: 𝒙 or 𝒙’. 33 The behavior of NOT operator is characterized by the truth table shown below: The NOT truth table To physically perform logic operations on binary data in a computer, we need to use electrical components. The components that represent the most fundamental operations are called logic gates, which can be combined in a logic circuit in order to create more complex operations. The NOT logic gate 14 October 2023 TM112-AOU
  • 34. 1.3 Representing logic operations and logic circuits • The AND operation • Most logical operations involve two input values.A truth table for two binary inputs, x and y, has more rows because there are four possible permutations (or ways of combining) the two input values, as shown inTable 2.19. AND logic gate AND truth table 34 14 October 2023 TM112-AOU
  • 35. Representing logic operations and logic circuits • The OR operation • truth table for the logic operationOR (which Boole originally designated by the symbol +) is shown below OR logic gate OR truth table 35 14 October 2023 TM112-AOU
  • 36. Building logic circuits • Suppose we want to build a logic circuit with two inputs,A and B, that tests if B is greater than A. • The first step is to create a truth table showing the desired outcomes: if B is greater than A, the result is 1 (True), otherwise the result is 0 (False). 36 14 October 2023 TM112-AOU
  • 37. Building logic circuits • To translate this into a logic expression – that is a combination of our logic operations (NOT,AND and OR) – we follow this algorithm. • Identify the row where the outcome (B > A) is 1. • If inputA is 1, write A; otherwise write NOT A in the logic expression for the selected row. • If input B is 1, write B; otherwise write NOT B in the logic expression for the selected row. • Join these with anAND, and the final equation will be the sum of all the deduced logic expressions. 37 Final equation: A’. B 14 October 2023 TM112-AOU
  • 38. Building logic circuits • Here, the resulting logic expression NOTA AND B tells us that the logic circuit that is equivalent to this truth table for each combination of inputs can be constructed from two logic gates • a NOT gate withA as an input, which gives an output of NOTA • an AND gate that takes NOT A and B as inputs, which gives the required result NOTA AND B as an output. 38 14 October 2023 TM112-AOU
  • 39. Building logic circuits 39 In the above circuit: The output of gate 1 is: 𝒙 + 𝒚 The output of gate 2 is: 𝒚 + 𝒛 The output of gate 3 is: 𝒙 + 𝒚 ( 𝒚 + 𝒛) 14 October 2023 TM112-AOU
  • 40. What is inside a logic gate? • How Logic gates are actually constructed , and what exactly is inside a logic gate? • A Logic gate is itself made up of a combination of more fundamental components that act as on/off switches. • In early computers, such devices were generally based on various designs of vacuum tube (collectively called valves). • In modern computers, they are based on transistors, which are formed of layers of semiconducting material such as silicon. 40 A ‘pluggable’ unit made of valves from an IBM computer of the mid-1950s A chip containing six inverters 14 October 2023 TM112-AOU