0% found this document useful (0 votes)
3 views

Data REpresentation

The document explains the representation of fractional numbers in binary, detailing fixed point and floating point forms. It covers methods for converting between binary and denary, including handling signed numbers and normalization for floating point representation. The document emphasizes the importance of bit allocation for precision in representing large and small numbers.

Uploaded by

prasitsubedee
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)
3 views

Data REpresentation

The document explains the representation of fractional numbers in binary, detailing fixed point and floating point forms. It covers methods for converting between binary and denary, including handling signed numbers and normalization for floating point representation. The document emphasizes the importance of bit allocation for precision in representing large and small numbers.

Uploaded by

prasitsubedee
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/ 52

D ATA

R E P R E S E N TAT I O N
REPRESENTING FRACTIONAL
NUMBERS IN BINARY
• The place values of fractional numbers in binary are doubled every time we move
one digit to the left of the binary point, and are halved every time we move one digit to
the right of the binary point. For example, the place values for 0010.1101​ are:
EXPRESSING FRACTIONAL NUMBERS

• To work with fractional numbers in binary, we need to be able to perform calculations


using fractions in denary.
• For example, consider the following binary fractional number that has 6 digits before
the binary point and 6 digits after the binary point.
EXPRESSING THE ANSWER
FIXED POINT
REPRESNTATION
FIXED POINT FORM
• Fractional binary numbers can be represented in fixed point or floating point form.
In fixed point form, the binary point is set in a fixed position, and therefore it does not
need to be stored in memory. In the example below, the binary point is assumed to be
between the fourth and the fifth bit (working from the left). Hence, the fraction is
represented in binary as 0100010 and this can be interpreted as equivalent to
0100.0102​.
CONVERTING FIXED POINT
BINARY TO DENARY
• Consider the binary number 01111011​ which is in unsigned fixed point form with 4 places
before the binary point and 4 places after the binary point.

• Convert the binary number 0001011100 to denary. It is represented in unsigned fixed point form
with 6 places before the binary point and 4 places after the binary point.
CONVERTING
DENARY TO FIXED POINT BINARY
1
• Convert 14 (14.125)​ to an unsigned fixed point binary number using 5 bits for the
8
whole part and 3 bits for the fractional part.
• Two method can be used
• Use the place value (Method 1)
CONVERTING
DENARY TO FIXED POINT BINARY
• Multiply by 2 (Method 2)
Convert the whole part of the number. Take the fractional part of the number and multiply it by 2.
Write down the whole number of the answer; it should either be 1 or 0.

𝟓
Q) Convert the denary number 12𝟏𝟔 (or 12.3125) to an unsigned fixed point binary number with 6 places
before the binary point and 4 places after the binary point.
𝟑
Q) Convert 12𝟏𝟎 (or 9.3) to an unsigned fixed point binary number using 5 bits for the whole part and 3
bits for the fractional part.
SIGNED FRACTIONAL NUMBER IN
FIXED POINT REPRESENTATION
CONVERTING FROM BINARY TO
DENARY
• We can use place values to find the denary value of a negative binary number
represented in two's complement fixed point form.
• Consider the negative binary number 10110110 with 5 places before the binary point
and 3 places after the binary point.

• Convert the binary number 11101111 to denary. The number is represented in signed fixed
point form with 5 digits before the binary point and 3 digits after the binary point
CONVERTING FROM DENARY TO
BINARY
3
• Consider the negative denary number -23 (or −23.25 as a decimal).
4
Convert the number to binary, encoding the number as a fixed point two’s complement
number with 6 places before the binary point and 4 places after the binary point.
• There are two methods for converting a negative denary number to a two's complement
fixed point binary number.
– Start from the positive and then find the negative equivalent
• Find 23.25 then find its 2’s complement
– Use place values
𝟏
• Convert the denary number -19 (or −19.25 as a decimal) to binary, encoding the number as
𝟒
a fixed point two’s complement number with 6 places before the binary point and 4 places after
the binary point.
RANGE OF VALUES IN FIXED POINT
FORM
• Unsigned fixed point form
𝟏𝟓
– Largest : 1𝟓 𝟏𝟔
𝟏
– Smallest : 𝟏𝟔
• Signed fixed point form
• Positive fixed point number
𝟏𝟓
– Largest : 7𝟏𝟔
𝟏
– Smallest :
𝟏𝟔

• Negative fixed point number


– Largest : -8
𝟏
– Smallest : -
𝟏𝟔
F L O AT I N G P O I N T
R E P R E S E N TAT I O N
INTRODUCTION
• In fixed point representation, the binary point is set in a specific place and so the allocation of the bits
between the whole part and fractional part cannot change.
• There is a trade off between the number of bits allocated to each part.
• A larger number of bits for the whole part will allow very large values to be represented, but without the
detail of the fractional part.
• A larger number of bits for the fractional part will allow very small and increasingly precise values to be
represented after the binary point, but the whole part will be constrained to small numbers
• When dealing with very large or very small numbers, a more flexible technique, known as floating point
representation is employed. This allows the way that the bits are allocated to vary so that both very large
and very small numbers can be represented.
• Binary floating point numbers are expressed in the form mantissa × 𝟐exponent
e.g. 0.101 x 𝟐4 . Here, the mantissa is 0.101 and the exponent is 4.
• We can recognize this way of representing numbers as scientific notation or standard form.
For example, in denary, the number 0.0007910 can be written in standard form 7.9 x 𝟏𝟎−4 .
Here, 7.9 is the mantissa and −4 is the exponent.

• The two's complement representation is used for both the mantissa and the exponent. The two's
complement mantissa allows positive and negative values to be stored. The two's complement exponent
allows both positive and negative exponents to be stored, which means that very large and very small values
can be represented. For example 0.101 x 𝟐4 the place values are presented below.
CONVERTING
BINARY FLOATING POINT NUMBER TO DENARY

• Method 1 - Using the numerical expression


• Method 2 - Shifting the binary point
– Here we use the value of the exponent to move the binary point.
The mantissa represents a value with a binary point between the two most significant bits.
The exponent determines how far to 'float' the point to determine the final value of the number.
• If the exponent is positive, the final value will be larger than the mantissa, so the point will 'float' to the
right — the number of places it will move is determined by the value of the exponent.
• If the exponent is negative, the point will 'float' to the left — for the number of places determined by the
exponent.

• Various cases can be:


– positive mantissa, positive exponent
– positive mantissa, negative exponent
– negative mantissa, positive exponent
– negative mantissa, negative exponent
POSITIVE MANTISSA, POSITIVE EXPONENT
• Convert 010001000101 to denary. The mantissa is 8 bits and the exponent is 4 bits.
POSITIVE MANTISSA, NEGATIVE EXPONENT
• Convert 010100001111 to denary. The mantissa is 8 bits and the exponent is 4 bits.
NEGATIVE MANTISSA, POSITIVE EXPONENT
• Convert 101111000011​ to denary. The mantissa is 8 bits and the exponent is 4 bits.
NEGATIVE MANTISSA, NEGATIVE EXPONENT
• Convert 101000001110​ to denary. The mantissa is 8 bits and the exponent is 4 bits.
N O R M A L I Z AT I O N
OF
F L O AT I N G P O I N T N U M B E R
INTRODUCTION
• The normalized version of a fractional number provides a unique representation for
a number and allows the maximum possible precision with a given number of bits.
Therefore, it is very useful when working with very large or very small numbers.
MOST IMPORTANT POINT

• The normalized version of a positive fractional number has no leading zeros after
the binary point — a normalized positive number always starts as 0.1

• The normalized version of a negative fractional number has no leading ones after
the binary point — a normalized negative number always starts as 1.0
• The mantissa of a floating point number holds the significant bits of that number, i.e. the
detail of the value of a number.

• This means that when we need to store very precise fractional numbers, we benefit from having
lots of bits after the binary point.

• If we had 8 bits for a number's mantissa, then the normalized version would allow 7 of the 8 bits
to be used after the binary point.

• That's why with normalization, we can achieve the maximum possible accuracy for a specific
number of bits.
NORMALIZING A NUMBER

1. To normalize a floating point binary number, you need to check whether the number is positive
or negative by checking the sign of the mantissa, and act as follows:

• If the number is positive, you need to move through the mantissa from left to right until you find
the first bit whose value is 1,1. The binary point will be positioned immediately in front of this bit.
A normalized positive number always starts as 0.1

• If the number is negative, you need to move through the mantissa from left to right until you find
the first bit whose value is 0,0. The binary point will be positioned immediately in front of this bit.
A normalised negative number always starts as 1.0
2. After we move the binary point, we must adjust the exponent so that the value of the number
remains the same.

• Moving the binary point one place to the right is equal to a left shift that multiplies the
number by 2. Hence, you need to compensate by dividing the number by 2, which you can do
by reducing the exponent by 1.

• Moving the binary point one place to the left is equal to a right shift that divides the number
by 2. Hence, you need to compensate by multiplying the number by 2, which you can do
by increasing the exponent by 1.
POSITIVE MANTISSA –
MOVING BINARY POINT RIGHT
• Normalize the floating point number with mantissa 0.0001011 and exponent = 0101
NEGATIVE MANTISSA – MOVING BINARY POINT RIGHT
• Normalize the floating point number with mantissa 1.1111001 and exponent = 0001

POSITIVE MANTISSA – MOVING BINARY POINT LEFT


• Normalize the floating point number with mantissa 0100.0111 and exponent = 1100

NEGATIVE MANTISSA – MOVING BINARY POINT LEFT


• Normalize the floating point number with mantissa 11110.111 and exponent = 1101
DENARY NUMBER
TO
FLOATING POINT BINARY

• To convert a denary number to floating point binary, first convert it to a fixed point
binary number.
• The next step is to normalise the number.
QUESTIONS
• Convert
3
– +9.75(+94)
1
– +17.5(+17 )
2
3
– +0.046875(+ 64)
3
– +0.375(+ 8)
1
– -29.25(-29 )
4
1
– -17.5(-172)
5
– -0.625(− 8)
3
– -0.375(- 8)

You might also like