Computer
Organization &
Architecture
Unit2
2.1 Data representation: signed number representation,
fixed and floating point representations, character
representation
2.1 Introduction
A bit is the most basic unit of information in a
computer.
It is a state of “on” or “off” in a digital circuit.
Sometimes these states are “high” or “low”
voltage instead of “on” or “off..”
A byte is a group of eight bits.
A byte is the smallest possible addressable unit
of computer storage.
The term, “addressable,” means that a
particular byte can be retrieved according to
its location in memory.
2
2.1 Introduction
A word is a contiguous group of bytes.
Words can be any number of bits or bytes.
Word sizes of 16, 32, or 64 bits are most
common.
In a word-addressable system, a word is the
smallest addressable unit of storage.
A group of four bits is called a nibble.
Bytes, therefore, consist of two nibbles: a “high-
order nibble,” and a “low-order” nibble.
3
2.2 Positional Numbering Systems
Bytes store numbers using the position of each
bit to represent a power of 2.
The binary system is also called the base-2
system.
Our decimal system is the base-10 system. It
uses powers of 10 for each position in a
number.
Any integer quantity can be represented
exactly using any base (or radix).
4
2.2 Positional Numbering Systems
The decimal number 947 in powers of 10 is:
The decimal number 5836.47 in powers of 10 is:
5
5  103
+ 8  102
+ 3  101
+ 6  10
0
+ 4  10-1
+ 7  10-2
9  102
+ 4  101
+ 7  100
2.2 Positional Numbering Systems
The binary number 11001 in powers of 2 is:
When the radix of a number is something other
than 10, the base is denoted by a subscript.
Sometimes, the subscript 10 is added for
emphasis:
110012 = 2510
6
1  24
+ 1  23
+ 0  22
+ 0  21
+ 1  20
= 16 + 8 + 0 + 0 + 1 = 25
2.3 Converting Between Bases
 Converting 190 to base 2
19010 = 101111102
7
2 190
2 95 0
2 47 1
2 23 1
2 11 1
2 5 1
2 2 1
2 1 0
0 1
2.3 Converting Between Bases
 Converting 0.8125 to binary . . .
 You are finished when the product is
zero, or until you have reached the
desired number of binary places.
 Our result, reading from top to bottom
is:
0.812510 = 0.11012
 This method also works with any base.
Just use the target radix as the
multiplier.
8
2.3 Converting Between Bases
The binary numbering system is the most
important radix system for digital computers.
However, it is difficult to read long strings of binary
numbers -- and even a modestly-sized decimal
number becomes a very long binary number.
For example: 110101000110112 = 1359510
For compactness and ease of reading, binary
values are usually expressed using the
hexadecimal, or base-16, numbering system.
9
Decimal,
Binary,
Hexadecimal,
Octal
10
Decimal Binary Hexadecimal Octal
0 00000 0 0
1 0001 1 1
2 0010 2 2
3 0011 3 3
4 0100 4 4
5 0101 5 5
6 0110 6 6
7 0111 7 7
8 1000 8 10
9 1001 9 11
10 1010 A 12
11 1011 B 13
12 1100 C 14
13 1101 D 15
14 1110 E 16
15 1111 F 17
2.3 Converting Between Bases
Using groups of four bits, the binary number
110101000110112 (= 1359510) in hexadecimal is:
Octal (base 8) values are derived from binary by
using groups of three bits (8 = 23
):
11
Octal was very useful when computers used six-bit
words.
If the number of bits is not a
multiple of 4, pad on the left
with zeros.
2.4 Signed Integer Representation
The conversions we have so far presented have
involved only unsigned numbers.
To represent signed integers, computer systems
allocate the high-order bit to indicate the sign of a
number.
The high-order bit is the leftmost bit. It is also
called the most significant bit.
 0 is used to indicate a positive number; 1
indicates a negative number.
The remaining bits contain the value of the number
(but this can be interpreted different ways)
12
2.4 Signed Integer Representation
There are three ways in which signed binary
integers may be expressed:
Signed magnitude
One’s complement
Two’s complement
In an 8-bit word, signed magnitude
representation places the absolute value of
the number in the 7 bits to the right of the
sign bit.
13
2.4 Signed Integer Representation
 For example, in 8-bit signed magnitude
representation:
+3 is: 00000011
- 3 is: 10000011
 Computers perform arithmetic operations on
signed magnitude numbers in much the same
way as humans carry out pencil and paper
arithmetic.
Humans often ignore the signs of the operands
while performing a calculation, applying the
appropriate sign after the calculation is
complete.
14
2.4 Signed Integer Representation
Example:
Using signed magnitude
binary arithmetic, find
the sum of 75 and 46.
 First, convert 75 and 46 to
binary, and arrange as a sum,
but separate the (positive)
sign bits from the magnitude
bits.
15
2.4 Signed Integer Representation
Signed magnitude representation is easy for
people to understand, but it requires
complicated computer hardware.
Another disadvantage of signed magnitude is
that it allows two different representations for
zero: positive zero and negative zero.
For these reasons (among others) computers
systems employ complement systems for
numeric value representation.
16
Complementary Number Representation
Two types of complements for base R number system:
- R's complement and (R-1)'s complement
The (R-1)'s Complement
Subtract each digit of a number from (R-1)
Example
- 9's complement of 83510 is 16410
- 1's complement of 10102 is 01012(bit by bit complement operation)
The R's Complement
Add 1 to the low-order digit of its (R-1)'s complement
Example
- 10's complement of 83510 is 16410 + 1 = 16510
- 2's complement of 10102 is 01012 + 1 = 01102
Complements
Complementary Number Representation
In the r’s complement representation, r represents the
radix. Depending upon the radix or base the
complimentary representation is as follows:
Binary number system: 1’s complement and 2’s
complement.
Decimal number system: 9’s complement and 10’s
complement.
Octal number system: 7’s complement and 8’s
complement.
Hexadecimal number system: F’s complement and
16’s complement.
To determine the (r-1)’s we need to subtract the given number
from the maximum number of the given base. Similarly to
determine the r’s complement first determine the (r-1)’s
complement of the given number and finally add 1 to the
LSB(Least Significant Bit).
Determine the 1’s and 2’s complement of
the binary number 1011
First find 1’s complement of a number by flipping
numbers e.g 1’s complement of 1011 is 0100
Second, Determine the 2’s complement of number
by adding 1 to the LSB of the 1’s complement result.
0100
+ 0001
———–
0101→ This is the 2’s complement of 1011
Subtraction of Binary numbers
using 1’s and 2’s complement
Consider the two binary numbers X = 1010100 and Y = 1000011, we perform
the subtraction X – Y and Y - X using 2's complemenfs:
Determine the 9’s and 10’s
complement of the decimal
number
a) first find 9’s complement of decimal number by
subtracting each digit from 9
example for 6298, 9’s complement is
9999
– 6298
———–
3701 → This is the 9’s complement of 6298
b) To find Find 10’s Complement of a decimal number
add 1 to its 9’s Complement
example 10s complement of 6298 is
=9s complement of 6298+1=3701+1
=3702
Subtraction of Decimal numbers
using 9’s and 10’s complement
2.5 Floating-Point Representation
The signed magnitude, one’s complement,
and two’s complement representation that we
have just presented deal with signed integer
values only.
Without modification, these formats are not
useful in scientific or business applications
that deal with real number values.
Floating-point representation solves this
problem.
23
2.5 Floating-Point Representation
If we are clever programmers, we can perform
floating-point calculations using any integer format.
This is called floating-point emulation, because
floating point values aren’t stored as such; we just
create programs that make it seem as if floating-
point values are being used.
Most of today’s computers are equipped with
specialized hardware that performs floating-point
arithmetic with no special programming required.
24
2.5 Floating-Point Representation
Floating-point numbers allow an arbitrary
number of decimal places to the right of the
decimal point.
For example: 0.5  0.25 = 0.125
 They are often expressed in scientific notation.
For example:
0.125 = 1.25  10-1
5,000,000 = 5.0  106
25
2.5 Floating-Point Representation
Computers use a form of scientific notation for
floating-point representation
Numbers written in scientific notation have three
components:
26
2.5 Floating-Point Representation
Computer representation of a floating-point
number consists of three fixed-size fields:
This is the standard arrangement of these fields.
27
Note: Although “significand” and “mantissa” do not technically mean the same
thing, many people use these terms interchangeably. We use the term “significand”
to refer to the fractional part of a floating point number.
2.5 Floating-Point Representation
We introduce a hypothetical “Simple Model” to
explain the concepts
In this model:
A floating-point number is 14 bits in length
The exponent field is 5 bits
The significand field is 8 bits
28
2.5 Floating-Point Representation
Example:
Express 3210 in the simplified 14-bit floating-point
model.
 We know that 32 is 25
. So in (binary) scientific
notation 32 = 1.0 x 25
= 0.1 x 26
.
In a moment, we’ll explain why we prefer the
second notation versus the first.
 Using this information, we put 110 (= 610) in the
exponent field and 1 in the significand as shown.
29
2.5 Floating-Point Representation
The IEEE has established a standard for
floating-point numbers
The IEEE-754 single precision floating point
standard used to represent 32 bit data in which
1 bit for sign, 8-bit exponent (with a bias of 127)
and a 23-bit significand.
The IEEE-754 double precision standard used
to represent 64 bit data in which 1 bit for sign,
11-bit exponent (with a bias of 1023) and a 52-
bit significand.
30
2.5 Floating-Point Representation
In both the IEEE single-precision and double-
precision floating-point standard, the significant has
an implied 1 to the LEFT of the radix point.
The format for a significand using the IEEE format
is: 1.xxx…
For example, 4.5 = .1001 x 23
in IEEE format is 4.5 =
1.001 x 22
. The 1 is implied, which means is does
not need to be listed in the significand (the
significand would include only 001).
31
2.5 Floating-Point Representation
 Example: Express -3.75 as a floating point number using
IEEE single precision.
 First, let’s normalize according to IEEE rules:
 3.75 = -11.112 = -1.111 x 21
 The bias is 127, so we add 127 + 1 = 128 (this is our exponent)
 The first 1 in the significand is implied, so we have:
 Since we have an implied 1 in the significand, this equates to
-(1).1112 x 2 (128 – 127)
= -1.1112 x 21
= -11.112 = -3.75.
32
(implied)
2.6 Character
Codes
Calculations aren’t useful until their results can
be displayed in a manner that is meaningful to
people.
We also need to store the results of calculations,
and provide a means for data input.
Thus, human-understandable characters must be
converted to computer-understandable bit
patterns using some sort of character encoding
scheme.
33
2.6 Character
Codes
Binary-coded decimal
(BCD) was one of these
early codes. It was used
by IBM mainframes in
the 1950s and 1960s.
34
Decimal
Digit
BCD
8 4 2 1
0 0 0 0 0
1 0 0 0 1
2 0 0 1 0
3 0 0 1 1
4 0 1 0 0
5 0 1 0 1
6 0 1 1 0
7 0 1 1 1
8 1 0 0 0
9 1 0 0 1
2.6 Character
Codes
In 1964, BCD was extended to an 8-bit code,
Extended Binary-Coded Decimal Interchange
Code (EBCDIC). See textbook Page 89
EBCDIC was one of the first widely-used
computer codes that supported upper and
lowercase alphabetic characters, in addition to
special characters, such as punctuation and
control characters.
EBCDIC and BCD are still in use by IBM
mainframes today.
35
2.6 Character
Codes
Other computer manufacturers chose the 7-bit
ASCII (American Standard Code for Information
Interchange) as a replacement for 6-bit codes.
see textbook page 90.
While BCD and EBCDIC were based upon
punched card codes, ASCII was based upon
telecommunications (Telex) codes.
Until recently, ASCII was the dominant
character code outside the IBM mainframe
world.
36
2.6 Character
Codes
Many of today’s systems embrace Unicode, a 16-
bit system that can encode the characters of
every language in the world.
The Java programming language, and some
operating systems now use Unicode as their
default character code.
The Unicode codespace is divided into six parts.
The first part is for Western alphabet codes,
including English, Greek, and Russian.
37
2.6 Character
Codes
 The Unicode codes-
pace allocation is
shown at the right.
 The lowest-numbered
Unicode characters
comprise the ASCII
code.
 The highest provide for
user-defined codes.
38

More Related Content

PPTX
Computer Oraganizaation.pptx
PDF
form-3-computer studies summarized NOTES.pdf
PPT
IS 139 Lecture 4 - 2015
PPT
IS 139 Lecture 4
PPTX
Number system
PDF
FYBSC IT Digital Electronics Unit I Chapter I Number System and Binary Arithm...
PPTX
Data Representation
PPTX
Number system in Digital Electronics
Computer Oraganizaation.pptx
form-3-computer studies summarized NOTES.pdf
IS 139 Lecture 4 - 2015
IS 139 Lecture 4
Number system
FYBSC IT Digital Electronics Unit I Chapter I Number System and Binary Arithm...
Data Representation
Number system in Digital Electronics

Similar to Data representation _ (20)

PPTX
ARCsxfhcjkvmnfxcgbfgcxhvbxdfzxcgbfxgcvbnx3.pptx
PDF
Data representation in computers
PDF
uyuyuy.pdf
PPTX
DOCX
Manoch1raw 160512091436
DOC
Chapter 4--Data representation Method.doc
PPT
Number_Systems _binary_octal_hex_dec.ppt
PPT
An introduction to the different number systems
PPT
Number Systems and its effectiveness .ppt
PPT
Number_Systems_Number base conversions.ppt
PPT
Number_Systems decimal, binary, octal, and hexadecimal
PPTX
1.1.1 BINARY SYSTEM
RTF
DCF QNA edited
PPT
Chapter 2 Data Representation.pptChapter 2 Data Representation.ppt
PPT
PPT
PDF
chapter one && two.pdf
PDF
DLD Chapter-1.pdf
PPTX
DLD-Introduction.pptx
PDF
Data representation computer architecture
ARCsxfhcjkvmnfxcgbfgcxhvbxdfzxcgbfxgcvbnx3.pptx
Data representation in computers
uyuyuy.pdf
Manoch1raw 160512091436
Chapter 4--Data representation Method.doc
Number_Systems _binary_octal_hex_dec.ppt
An introduction to the different number systems
Number Systems and its effectiveness .ppt
Number_Systems_Number base conversions.ppt
Number_Systems decimal, binary, octal, and hexadecimal
1.1.1 BINARY SYSTEM
DCF QNA edited
Chapter 2 Data Representation.pptChapter 2 Data Representation.ppt
chapter one && two.pdf
DLD Chapter-1.pdf
DLD-Introduction.pptx
Data representation computer architecture
Ad

More from SwatiHans10 (20)

PPT
ip addressing _
PPT
stop and wait _
PPT
PPT
subnetting _
PPT
PipelineHazards _
PPT
Pipelining _
PPTX
Mobile Customer Experience Management.pptx
PPTX
Social Web multimedia analytics goals _
PPTX
Hardwires and Microprogrammed Control ,
PPTX
Restoring Algorithm _
PPTX
Non -Restoring Algorithm _
PPTX
loops _
PPT
functions _
PDF
Instruction execution cycle _
PPT
RTL,Instruction set _
PPTX
CAO PPT-Lect 1 _
PPTX
CIRCULAR LINKED LIST _
PPT
Transmission control protocol _
PPTX
Numpy _
PPTX
Lecture 1 .
ip addressing _
stop and wait _
subnetting _
PipelineHazards _
Pipelining _
Mobile Customer Experience Management.pptx
Social Web multimedia analytics goals _
Hardwires and Microprogrammed Control ,
Restoring Algorithm _
Non -Restoring Algorithm _
loops _
functions _
Instruction execution cycle _
RTL,Instruction set _
CAO PPT-Lect 1 _
CIRCULAR LINKED LIST _
Transmission control protocol _
Numpy _
Lecture 1 .
Ad

Recently uploaded (20)

PDF
Computer organization and architecuture Digital Notes....pdf
PDF
Micro 4 New.ppt.pdf a servay of cells and microorganism
PDF
Unit I -OPERATING SYSTEMS_SRM_KATTANKULATHUR.pptx.pdf
PDF
Lesson 3 .pdf
PDF
Research on ultrasonic sensor for TTU.pdf
PDF
Project_Mgmt_Institute_-Marc Marc Marc .pdf
PDF
Present and Future of Systems Engineering: Air Combat Systems
PDF
Unit1 - AIML Chapter 1 concept and ethics
PPTX
CNS - Unit 1 (Introduction To Computer Networks) - PPT (2).pptx
PDF
Mechanics of materials week 2 rajeshwari
PPTX
Solar energy pdf of gitam songa hemant k
PDF
SEH5E Unveiled: Enhancements and Key Takeaways for Certification Success
PPTX
Micro1New.ppt.pptx the mai themes of micfrobiology
PPTX
CS6006 - CLOUD COMPUTING - Module - 1.pptx
PPTX
Wireless sensor networks (WSN) SRM unit 2
PDF
VSL-Strand-Post-tensioning-Systems-Technical-Catalogue_2019-01.pdf
PPTX
MAD Unit - 3 User Interface and Data Management (Diploma IT)
PDF
MACCAFERRY GUIA GAVIONES TERRAPLENES EN ESPAÑOL
PDF
August -2025_Top10 Read_Articles_ijait.pdf
PPTX
Agentic Artificial Intelligence (Agentic AI).pptx
Computer organization and architecuture Digital Notes....pdf
Micro 4 New.ppt.pdf a servay of cells and microorganism
Unit I -OPERATING SYSTEMS_SRM_KATTANKULATHUR.pptx.pdf
Lesson 3 .pdf
Research on ultrasonic sensor for TTU.pdf
Project_Mgmt_Institute_-Marc Marc Marc .pdf
Present and Future of Systems Engineering: Air Combat Systems
Unit1 - AIML Chapter 1 concept and ethics
CNS - Unit 1 (Introduction To Computer Networks) - PPT (2).pptx
Mechanics of materials week 2 rajeshwari
Solar energy pdf of gitam songa hemant k
SEH5E Unveiled: Enhancements and Key Takeaways for Certification Success
Micro1New.ppt.pptx the mai themes of micfrobiology
CS6006 - CLOUD COMPUTING - Module - 1.pptx
Wireless sensor networks (WSN) SRM unit 2
VSL-Strand-Post-tensioning-Systems-Technical-Catalogue_2019-01.pdf
MAD Unit - 3 User Interface and Data Management (Diploma IT)
MACCAFERRY GUIA GAVIONES TERRAPLENES EN ESPAÑOL
August -2025_Top10 Read_Articles_ijait.pdf
Agentic Artificial Intelligence (Agentic AI).pptx

Data representation _

  • 1. Computer Organization & Architecture Unit2 2.1 Data representation: signed number representation, fixed and floating point representations, character representation
  • 2. 2.1 Introduction A bit is the most basic unit of information in a computer. It is a state of “on” or “off” in a digital circuit. Sometimes these states are “high” or “low” voltage instead of “on” or “off..” A byte is a group of eight bits. A byte is the smallest possible addressable unit of computer storage. The term, “addressable,” means that a particular byte can be retrieved according to its location in memory. 2
  • 3. 2.1 Introduction A word is a contiguous group of bytes. Words can be any number of bits or bytes. Word sizes of 16, 32, or 64 bits are most common. In a word-addressable system, a word is the smallest addressable unit of storage. A group of four bits is called a nibble. Bytes, therefore, consist of two nibbles: a “high- order nibble,” and a “low-order” nibble. 3
  • 4. 2.2 Positional Numbering Systems Bytes store numbers using the position of each bit to represent a power of 2. The binary system is also called the base-2 system. Our decimal system is the base-10 system. It uses powers of 10 for each position in a number. Any integer quantity can be represented exactly using any base (or radix). 4
  • 5. 2.2 Positional Numbering Systems The decimal number 947 in powers of 10 is: The decimal number 5836.47 in powers of 10 is: 5 5  103 + 8  102 + 3  101 + 6  10 0 + 4  10-1 + 7  10-2 9  102 + 4  101 + 7  100
  • 6. 2.2 Positional Numbering Systems The binary number 11001 in powers of 2 is: When the radix of a number is something other than 10, the base is denoted by a subscript. Sometimes, the subscript 10 is added for emphasis: 110012 = 2510 6 1  24 + 1  23 + 0  22 + 0  21 + 1  20 = 16 + 8 + 0 + 0 + 1 = 25
  • 7. 2.3 Converting Between Bases  Converting 190 to base 2 19010 = 101111102 7 2 190 2 95 0 2 47 1 2 23 1 2 11 1 2 5 1 2 2 1 2 1 0 0 1
  • 8. 2.3 Converting Between Bases  Converting 0.8125 to binary . . .  You are finished when the product is zero, or until you have reached the desired number of binary places.  Our result, reading from top to bottom is: 0.812510 = 0.11012  This method also works with any base. Just use the target radix as the multiplier. 8
  • 9. 2.3 Converting Between Bases The binary numbering system is the most important radix system for digital computers. However, it is difficult to read long strings of binary numbers -- and even a modestly-sized decimal number becomes a very long binary number. For example: 110101000110112 = 1359510 For compactness and ease of reading, binary values are usually expressed using the hexadecimal, or base-16, numbering system. 9
  • 10. Decimal, Binary, Hexadecimal, Octal 10 Decimal Binary Hexadecimal Octal 0 00000 0 0 1 0001 1 1 2 0010 2 2 3 0011 3 3 4 0100 4 4 5 0101 5 5 6 0110 6 6 7 0111 7 7 8 1000 8 10 9 1001 9 11 10 1010 A 12 11 1011 B 13 12 1100 C 14 13 1101 D 15 14 1110 E 16 15 1111 F 17
  • 11. 2.3 Converting Between Bases Using groups of four bits, the binary number 110101000110112 (= 1359510) in hexadecimal is: Octal (base 8) values are derived from binary by using groups of three bits (8 = 23 ): 11 Octal was very useful when computers used six-bit words. If the number of bits is not a multiple of 4, pad on the left with zeros.
  • 12. 2.4 Signed Integer Representation The conversions we have so far presented have involved only unsigned numbers. To represent signed integers, computer systems allocate the high-order bit to indicate the sign of a number. The high-order bit is the leftmost bit. It is also called the most significant bit.  0 is used to indicate a positive number; 1 indicates a negative number. The remaining bits contain the value of the number (but this can be interpreted different ways) 12
  • 13. 2.4 Signed Integer Representation There are three ways in which signed binary integers may be expressed: Signed magnitude One’s complement Two’s complement In an 8-bit word, signed magnitude representation places the absolute value of the number in the 7 bits to the right of the sign bit. 13
  • 14. 2.4 Signed Integer Representation  For example, in 8-bit signed magnitude representation: +3 is: 00000011 - 3 is: 10000011  Computers perform arithmetic operations on signed magnitude numbers in much the same way as humans carry out pencil and paper arithmetic. Humans often ignore the signs of the operands while performing a calculation, applying the appropriate sign after the calculation is complete. 14
  • 15. 2.4 Signed Integer Representation Example: Using signed magnitude binary arithmetic, find the sum of 75 and 46.  First, convert 75 and 46 to binary, and arrange as a sum, but separate the (positive) sign bits from the magnitude bits. 15
  • 16. 2.4 Signed Integer Representation Signed magnitude representation is easy for people to understand, but it requires complicated computer hardware. Another disadvantage of signed magnitude is that it allows two different representations for zero: positive zero and negative zero. For these reasons (among others) computers systems employ complement systems for numeric value representation. 16
  • 17. Complementary Number Representation Two types of complements for base R number system: - R's complement and (R-1)'s complement The (R-1)'s Complement Subtract each digit of a number from (R-1) Example - 9's complement of 83510 is 16410 - 1's complement of 10102 is 01012(bit by bit complement operation) The R's Complement Add 1 to the low-order digit of its (R-1)'s complement Example - 10's complement of 83510 is 16410 + 1 = 16510 - 2's complement of 10102 is 01012 + 1 = 01102 Complements
  • 18. Complementary Number Representation In the r’s complement representation, r represents the radix. Depending upon the radix or base the complimentary representation is as follows: Binary number system: 1’s complement and 2’s complement. Decimal number system: 9’s complement and 10’s complement. Octal number system: 7’s complement and 8’s complement. Hexadecimal number system: F’s complement and 16’s complement. To determine the (r-1)’s we need to subtract the given number from the maximum number of the given base. Similarly to determine the r’s complement first determine the (r-1)’s complement of the given number and finally add 1 to the LSB(Least Significant Bit).
  • 19. Determine the 1’s and 2’s complement of the binary number 1011 First find 1’s complement of a number by flipping numbers e.g 1’s complement of 1011 is 0100 Second, Determine the 2’s complement of number by adding 1 to the LSB of the 1’s complement result. 0100 + 0001 ———– 0101→ This is the 2’s complement of 1011
  • 20. Subtraction of Binary numbers using 1’s and 2’s complement Consider the two binary numbers X = 1010100 and Y = 1000011, we perform the subtraction X – Y and Y - X using 2's complemenfs:
  • 21. Determine the 9’s and 10’s complement of the decimal number a) first find 9’s complement of decimal number by subtracting each digit from 9 example for 6298, 9’s complement is 9999 – 6298 ———– 3701 → This is the 9’s complement of 6298 b) To find Find 10’s Complement of a decimal number add 1 to its 9’s Complement example 10s complement of 6298 is =9s complement of 6298+1=3701+1 =3702
  • 22. Subtraction of Decimal numbers using 9’s and 10’s complement
  • 23. 2.5 Floating-Point Representation The signed magnitude, one’s complement, and two’s complement representation that we have just presented deal with signed integer values only. Without modification, these formats are not useful in scientific or business applications that deal with real number values. Floating-point representation solves this problem. 23
  • 24. 2.5 Floating-Point Representation If we are clever programmers, we can perform floating-point calculations using any integer format. This is called floating-point emulation, because floating point values aren’t stored as such; we just create programs that make it seem as if floating- point values are being used. Most of today’s computers are equipped with specialized hardware that performs floating-point arithmetic with no special programming required. 24
  • 25. 2.5 Floating-Point Representation Floating-point numbers allow an arbitrary number of decimal places to the right of the decimal point. For example: 0.5  0.25 = 0.125  They are often expressed in scientific notation. For example: 0.125 = 1.25  10-1 5,000,000 = 5.0  106 25
  • 26. 2.5 Floating-Point Representation Computers use a form of scientific notation for floating-point representation Numbers written in scientific notation have three components: 26
  • 27. 2.5 Floating-Point Representation Computer representation of a floating-point number consists of three fixed-size fields: This is the standard arrangement of these fields. 27 Note: Although “significand” and “mantissa” do not technically mean the same thing, many people use these terms interchangeably. We use the term “significand” to refer to the fractional part of a floating point number.
  • 28. 2.5 Floating-Point Representation We introduce a hypothetical “Simple Model” to explain the concepts In this model: A floating-point number is 14 bits in length The exponent field is 5 bits The significand field is 8 bits 28
  • 29. 2.5 Floating-Point Representation Example: Express 3210 in the simplified 14-bit floating-point model.  We know that 32 is 25 . So in (binary) scientific notation 32 = 1.0 x 25 = 0.1 x 26 . In a moment, we’ll explain why we prefer the second notation versus the first.  Using this information, we put 110 (= 610) in the exponent field and 1 in the significand as shown. 29
  • 30. 2.5 Floating-Point Representation The IEEE has established a standard for floating-point numbers The IEEE-754 single precision floating point standard used to represent 32 bit data in which 1 bit for sign, 8-bit exponent (with a bias of 127) and a 23-bit significand. The IEEE-754 double precision standard used to represent 64 bit data in which 1 bit for sign, 11-bit exponent (with a bias of 1023) and a 52- bit significand. 30
  • 31. 2.5 Floating-Point Representation In both the IEEE single-precision and double- precision floating-point standard, the significant has an implied 1 to the LEFT of the radix point. The format for a significand using the IEEE format is: 1.xxx… For example, 4.5 = .1001 x 23 in IEEE format is 4.5 = 1.001 x 22 . The 1 is implied, which means is does not need to be listed in the significand (the significand would include only 001). 31
  • 32. 2.5 Floating-Point Representation  Example: Express -3.75 as a floating point number using IEEE single precision.  First, let’s normalize according to IEEE rules:  3.75 = -11.112 = -1.111 x 21  The bias is 127, so we add 127 + 1 = 128 (this is our exponent)  The first 1 in the significand is implied, so we have:  Since we have an implied 1 in the significand, this equates to -(1).1112 x 2 (128 – 127) = -1.1112 x 21 = -11.112 = -3.75. 32 (implied)
  • 33. 2.6 Character Codes Calculations aren’t useful until their results can be displayed in a manner that is meaningful to people. We also need to store the results of calculations, and provide a means for data input. Thus, human-understandable characters must be converted to computer-understandable bit patterns using some sort of character encoding scheme. 33
  • 34. 2.6 Character Codes Binary-coded decimal (BCD) was one of these early codes. It was used by IBM mainframes in the 1950s and 1960s. 34 Decimal Digit BCD 8 4 2 1 0 0 0 0 0 1 0 0 0 1 2 0 0 1 0 3 0 0 1 1 4 0 1 0 0 5 0 1 0 1 6 0 1 1 0 7 0 1 1 1 8 1 0 0 0 9 1 0 0 1
  • 35. 2.6 Character Codes In 1964, BCD was extended to an 8-bit code, Extended Binary-Coded Decimal Interchange Code (EBCDIC). See textbook Page 89 EBCDIC was one of the first widely-used computer codes that supported upper and lowercase alphabetic characters, in addition to special characters, such as punctuation and control characters. EBCDIC and BCD are still in use by IBM mainframes today. 35
  • 36. 2.6 Character Codes Other computer manufacturers chose the 7-bit ASCII (American Standard Code for Information Interchange) as a replacement for 6-bit codes. see textbook page 90. While BCD and EBCDIC were based upon punched card codes, ASCII was based upon telecommunications (Telex) codes. Until recently, ASCII was the dominant character code outside the IBM mainframe world. 36
  • 37. 2.6 Character Codes Many of today’s systems embrace Unicode, a 16- bit system that can encode the characters of every language in the world. The Java programming language, and some operating systems now use Unicode as their default character code. The Unicode codespace is divided into six parts. The first part is for Western alphabet codes, including English, Greek, and Russian. 37
  • 38. 2.6 Character Codes  The Unicode codes- pace allocation is shown at the right.  The lowest-numbered Unicode characters comprise the ASCII code.  The highest provide for user-defined codes. 38