Data REpresentation
Data REpresentation
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
• 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 :
𝟏𝟔
• 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
• 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
• 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)