KEMBAR78
Chapter 16 Data Representation | PDF | Numbers | Decimal
0% found this document useful (0 votes)
6 views30 pages

Chapter 16 Data Representation

Uploaded by

Mr Saem
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)
6 views30 pages

Chapter 16 Data Representation

Uploaded by

Mr Saem
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
You are on page 1/ 30

A-Level CS 9618

Chapter 16

Chapter 16 Data representation


Data representation

www.mrsaem.com | www.sirsaem.com | mrsaem@yahoo.com


1
Fixed and Floating-Point Number
A-Level CS 9618
Chapter 16

Fixed and Floating-Point Number:


In digital technology, data is stored in memory registers with binary bits 0’s and 1’s
because the computer only understands binary language. When we enter data in the
system, it is converted into binary bits, and it is processed and used in the CPU in
different ways.
Data representation

Memory registers have a format and a specific range to store data. Scientists have
designed a real number representation method in memory registers of 8 bit, 16 bit,
32bit.

www.mrsaem.com | www.sirsaem.com | mrsaem@yahoo.com


2
A-Level CS 9618
Chapter 16

There two types of approaches that are developed to store real numbers with the
proper method.

•Fixed point number


Data representation

•Floating point number

www.mrsaem.com | www.sirsaem.com | mrsaem@yahoo.com


3
A-Level CS 9618
Chapter 16 Fixed point representation
In computing, fixed-point number representation is a real data type for a number. With the help
of fixed number representation, data is converted into binary form, and then data is processed,
stored and used by the system.
Fixed point representation of data
Data representation

Sign bit -The fixed-point numbers in binary uses a sign bit. A positive number has a sign bit 0,
while a negative number has a sign bit 1.
Integral Part – The integral part is of different lengths at different places. It depends on the
register's size, like in an 8-bit register, integral part is 4 bits.
Fractional part – Fractional part is also of different lengths at different places. It depends on the
register's size, like in an 8-bit register, integral part is of 3 bits.
8 bits = 1Sign bit + 4 bits(integral) + 3bits (fractional part)
16 bits = 1Sign bit + 9 bits(integral) +6 bits (fractional part)
32 bits = 1Sign bit + 15 bits(integral) + 9 bits (fractional part)
www.mrsaem.com | www.sirsaem.com | mrsaem@yahoo.com
4
A-Level CS 9618
Chapter 16 How to write the number in Fixed-point notation?

Number is 4.5
Step 1:- Convert the number into binary form. Note:- Range of fixed-point
notation is from -15.875
4.5 = 100.1 to +15.875. We conclude that
Step 2:- Represent binary number in Fixed point notation the fixed-point notation range is
very less as we can only
represent the number in a set
limit. It is not suitable for
presenting a large amount of
The smallest negative number in fixed-point representation. data, so it is not used in
Data representation

computer nowadays.
Therefore, scientists feel that the
system needs a new
representation format with the
least or no limit because data is
becoming a vast nowadays. So,
floating-point representation
came into existence.

www.mrsaem.com | www.sirsaem.com | mrsaem@yahoo.com


5
A-Level CS 9618
Chapter 16 Floating-point representation
To discard the limitation of fixed-point notation, floating-point number
representation was developed by scientists. The computer system uses floating-point
numbers representation to convert input data into binary form. The binary form
number is converted into ‘scientific notation,' and then this scientific notation is
converted into floating-point representation.
Data representation

The floating-point notation has two types of notation

1.Scientific notation
2.Normalized notation

www.mrsaem.com | www.sirsaem.com | mrsaem@yahoo.com


6
A-Level CS 9618
Chapter 16 Scientific notation –
Method of representing binary numbers into a x be form. Scientific notation is further
converted into floating-point notation because floating-point notation only accepts
scientific notation. For example:-

Number = 376.423 ( its not scientific notation)

Number in scientific = 36.4423 x 101 or 3.64423 x 102


Data representation

www.mrsaem.com | www.sirsaem.com | mrsaem@yahoo.com


7
A-Level CS 9618
Chapter 16

For example:- 32.625 x 103


1101.101 * 2101
where 1101.101 is the mantissa part.
2101 = It is the base part where we need not explicitly represent radix or base
because the binary base is always 2.
Data representation

Note: The major problem in this notation is while storing mantissa, we need
to tell the decimal position every time to the processor. So to overcome this
problem, normalized notation was invented and used.
Normalized notation- It is a special case of scientific notation. Normalized
means after the decimal point, we have atleast one non-zero digit.

www.mrsaem.com | www.sirsaem.com | mrsaem@yahoo.com


8
A-Level CS 9618
Chapter 16 Normalized notation -

where, value of m= .1?m?1, b= base, e= exponent integer


± 0.1bbbb…..b * 2±e
Data representation

If mantissa =101, then the processor will interpret it as 0.101 itself, so it's not
necessary to tell the position of the decimal point every time to the processor.
For example- .36 x 1035 is a normalized notation in which the value of m is between
.1 to 1. In normalized notation, value of m remains between .1 ?m?1.
For example:- 1101.101 * 2101 = (5)10 (convert this into normalized form)
0.1101101 * 2(1001)2 =(9)10=(5+4)10

www.mrsaem.com | www.sirsaem.com | mrsaem@yahoo.com


9
A-Level CS 9618
Chapter 16

So, there is no need to tell about the decimal point's position every time to the
processor.
•Zero (0) cannot be represented or normalized because the representation set starts
from 0.1, so how can we normalize zero. It’s not possible.
• If the most significant bit of mantissa is a non zero, then such a representation is
called normalized floating-point.
Data representation

So, four things are used to represent a floating-point number: -


1.Sign of Mantissa
2.Sign of Exponent
3.Magnitude of Mantissa
4.Magnitude of Exponent

www.mrsaem.com | www.sirsaem.com | mrsaem@yahoo.com


10
A-Level CS 9618
Chapter 16 How to represent a number in floating-point
representation?
Floating-point representation of data in a 16-bit register.

Sign bit -The fixed-point numbers in binary uses a sign bit. A positive number has a sign bit 0,
Data representation

while a negative number has a sign bit 1. In floating-point representation, sign of a number
always depends on mantissa, not on exponent. Hence sign bit in the format is always for mantissa
and not for the exponent.
Mantissa Part –Mantissa part is of different length at a different place. It depends on the size of
the register like in 16-bit register; mantissa part is of 8 bits.
Exponent part – Exponent is the power of the number. It depends on the register's size; like in
the 16-bit register, exponent part is 7 bits. Excess 16,64,128, 512 are used to store exponent in
this format.

www.mrsaem.com | www.sirsaem.com | mrsaem@yahoo.com


11
A-Level CS 9618
Chapter 16 Convert a decimal number to binary floating point
representation
To convert a decimal number to binary floating point representation:

• Convert the absolute value of the decimal number to a binary integer


plus a binary fraction.

• Normalize the number in binary scientific notation to obtain m and e.


Data representation

• Set s=0 for a positive number and s=1 for a negative number.

www.mrsaem.com | www.sirsaem.com | mrsaem@yahoo.com


12
A-Level CS 9618
Chapter 16

First calculate -6 in pure binary


Data representation

www.mrsaem.com | www.sirsaem.com | mrsaem@yahoo.com


13
A-Level CS 9618
Chapter 16
Data representation

www.mrsaem.com | www.sirsaem.com | mrsaem@yahoo.com


14
A-Level CS 9618
Chapter 16
Data representation

www.mrsaem.com | www.sirsaem.com | mrsaem@yahoo.com


15
A-Level CS 9618
Chapter 16
Data representation

www.mrsaem.com | www.sirsaem.com | mrsaem@yahoo.com


16
A-Level CS 9618
Chapter 16 Converting from Binary to Denary
A POSITIVE NUMBER SHOULD
ALWAYS START WITH 0 THAN 1
PLUS GET RID OF ANY
MEANINGLESS 0 ON THE LEFT
HAND SIDE. SO THAT YOU HAVE
THIS IS 4 BITS AGAIN ALLTOGATHER.
CERTAINLY A
Data representation

POSITIVE
NUMBER
SINCE THE
LEFT MOST
DIGIT IS A 0

www.mrsaem.com | www.sirsaem.com | mrsaem@yahoo.com


17
A-Level CS 9618
Chapter 16

BY PUTTING THE DECIMAL POINT IMMIDIATLY TO THE RIGHT AFTER THE MOST
SIGNIFICANT DIGIT.
Data representation

www.mrsaem.com | www.sirsaem.com | mrsaem@yahoo.com


18
A-Level CS 9618
Chapter 16
Data representation
Converting from Binary to Denary

www.mrsaem.com | www.sirsaem.com | mrsaem@yahoo.com


19
A-Level CS 9618
Chapter 16

THIS IS CERTAINLY A A POSITIVE NUMBER SHOULD


POSITIVE NUMBER ALWAYS START WITH 0 THAN 1
Data representation

SINCE THE LEFT MOST PLUS GET RID OF ANY


DIGIT IS A 0 MEANINGLESS 0 ON THE LEFT
HAND SIDE. SO THAT YOU HAVE 4
BITS AGAIN ALLTOGATHER.

www.mrsaem.com | www.sirsaem.com | mrsaem@yahoo.com


20
A-Level CS 9618
Chapter 16

Since we have moved the


digit to the right we have
2-2
Data representation

Add the both exponent values.

www.mrsaem.com | www.sirsaem.com | mrsaem@yahoo.com


21
A-Level CS 9618
Chapter 16
Data representation

www.mrsaem.com | www.sirsaem.com | mrsaem@yahoo.com


22
A-Level CS 9618
Chapter 16
Data representation

www.mrsaem.com | www.sirsaem.com | mrsaem@yahoo.com


23
A-Level CS 9618
Chapter 16
Data representation

You then need to remove


the leading ones from the
mantissa and pad it with
trailing zeros,

www.mrsaem.com | www.sirsaem.com | mrsaem@yahoo.com


24
A-Level CS 9618
Chapter 16

You then need to


Data representation

remove the leading


ones from the
mantissa and pad it
with trailing zeros,

www.mrsaem.com | www.sirsaem.com | mrsaem@yahoo.com


25
A-Level CS 9618
Chapter 16
Data representation

www.mrsaem.com | www.sirsaem.com | mrsaem@yahoo.com


26
A-Level CS 9618
Chapter 16
Data representation

www.mrsaem.com | www.sirsaem.com | mrsaem@yahoo.com


27
A-Level CS 9618
Chapter 16
Data representation

www.mrsaem.com | www.sirsaem.com | mrsaem@yahoo.com


28
A-Level CS 9618
Chapter 16
Data representation

www.mrsaem.com | www.sirsaem.com | mrsaem@yahoo.com


29
A-Level CS 9618
Chapter 16
Data representation

www.mrsaem.com | www.sirsaem.com | mrsaem@yahoo.com


30

You might also like