Question

In: Computer Science

1. If you stored the following binary number (-0.000000100101) as a binary floating point number, what...

1. If you stored the following binary number (-0.000000100101) as a binary floating point number, what value would be STORED in the exponent section? Also convert A7.11 Hex value to floating point.

2. Number of bits saved using Huffman encoding. From the following characters used in a message with their associated frequency, use Huffman Coding as a compression technique. How many bits will be saved in the message? (Keep in mind that one character is one byte which consists of 8 bits). Draw the associated Huffman Tree to help calculate your answer. Show all your work. (15 points)

Character                                                                                            Frequency

A

6

B

11

C

13

D

14

E

19

F

47

Solutions

Expert Solution

1)

Finding exponent :

First we normalize 0.000000100101. We keep shifting decimal place to the right until there is one non-zero to the left of decimal.

0.000000100101 * 20

00.00000100101 * 2-1

000.0000100101 * 2-2

...........

1.00101 * 2-7

Exponent of 2 is -7. But there is a bias 127, hence (-7 + 127 = 120) is our exponent.

(120)10 = (01111000)2

Hence 120 / 01111000 will be stored in the exponent part of the floating point representation.

Converting A7.11 to floating point :

A7.11 is first converted to binary.

Since A = 10 = 1010, 7 = 0111, 1 = 0001

(A7.11)16 = (10100111.00010001)2

We will normalize this by shifting decimal to left.

10100111.00010001 * 20

1010011.100010001 * 21

101001.1100010001 * 22

............

1.010011100010001 * 27

sign is positive = 0

exponent is 7 = 127 + 7 = 134 = 10000110

mantissa = 010011100010001 (trailing zeroes are added because mantissa's length is 23 bits)

2)

The huffman tree is as generated :

The minimum freq is of A and B and hence they combine to give Node of 17 (11+6)

Now the minimum freq is of C and D and hence they combine to give Node of 27 (13+14)

Now minimum freq is of E and Node of 17, which combine to give Node of 36 (19 + 17)

Now minimum freq is of Node of 36 and Node of 27, which combine to give Node of 63 (36 + 27)

Now minimum freq is of Node of 63 and F, which combine to give Node of 110 (63 + 47). Final tree is :

Huffman Codes of the characters -

A - 0000

B - 0001

C - 010

D - 011

E - 001

F - 1

Total number of bits in Huffman encoded message = ∑ ( frequencyi x code lengthi )

= { (6*4) + (11*4) + (13*3) + (14*3) + (19*3) + (47*1) }

= { 24 + 44 + 39 + 42 + 57 + 47 }

= { 253 }

if we dont use huffman then,

each character takes 8 bits so for A = 8*6 = 48

for B = 11*8 = 88

for C = 13*8 = 104

for D = 14*8 = 112

for E = 19*8 = 152

for F = 47*8 = 376

total = 880 bits

bits saved = 880 - 253 = 627 bits

Hope this helped.


Related Solutions

Convert the following floating-point number (stored using IEEE floating-point standard 754) to a binary number in...
Convert the following floating-point number (stored using IEEE floating-point standard 754) to a binary number in non-standard form. 0100_0001_1110_0010_1000_0000_0000_0000
Using the simple model for representing binary floating point numbers A floating-point number is 14 bits...
Using the simple model for representing binary floating point numbers A floating-point number is 14 bits in length. The exponent field is 5 bits. The significand field is 8 bits. The bias is 15 Represent -32.5010 in the simple model.
The number –11.375 (decimal) represented as a 32-bit floating-point binary number according to the IEEE 754...
The number –11.375 (decimal) represented as a 32-bit floating-point binary number according to the IEEE 754 standard is
Convert the following binary floating point  to decimal IEEE 32-bit floating point format.   0 1000 0101 000...
Convert the following binary floating point  to decimal IEEE 32-bit floating point format.   0 1000 0101 000 0100 1101 0000 0000 0000
Write a program that converts a given floating point binary number with a 24-bit normalized mantissa...
Write a program that converts a given floating point binary number with a 24-bit normalized mantissa and an 8-bit exponent to its decimal (i.e. base 10) equivalent. For the mantissa, use the representation that has a hidden bit, and for the exponent use a bias of 127 instead of a sign bit. Of course, you need to take care of negative numbers in the mantissa also. Use your program to answer the following questions: (a) Mantissa: 11110010 11000101 01101010, exponent:...
Q1.Convert C46C000016 into a 32-bit single-precision IEEE floating-point binary number.
Q1.Convert C46C000016 into a 32-bit single-precision IEEE floating-point binary number.
c) Using the 32-bit binary representation for floating point numbers, represent the number 1011100110011 as a...
c) Using the 32-bit binary representation for floating point numbers, represent the number 1011100110011 as a 32 bit floating point number. i) A digital camera processes the images images in the real-world and stores them in binary form. Using the principles of digital signal processing, practically explain how this phenomenon occurs.
Convert the decimal floating point value 8.125 to a 12 bit binary floating point value. Use...
Convert the decimal floating point value 8.125 to a 12 bit binary floating point value. Use a sign bit, 3 bits (excess 3) for the exponent and an 8 bit significand. Enter just a 12 digit binary value ( e.g. 0 000 11110000 ) spaces ignored.
Assume that you have a 12-bit floating point number system, similar to the IEEE floating point...
Assume that you have a 12-bit floating point number system, similar to the IEEE floating point standard, with the format shown below and a bias of 7. The value of a floating point number in this system is represented as    FP = (-1)^S X 1.F X 2^(E-bias) for the floating point numbers A = 8.75 and B = -5.375. The binary representation of A is given as A = 0101 0000 1100 Show the hexidecimal representation of B.
3. IEEE Floating Point Representation What decimal number does the 32-bit IEEE floating point number 0xC27F0000...
3. IEEE Floating Point Representation What decimal number does the 32-bit IEEE floating point number 0xC27F0000 represent? Fill in the requested information in the blanks below. What is the sign of the number (say positive or negative): What is the exponent in decimal format: What is the significand in binary: What is the value of the stored decimal number in decimal (final answer): Credit will be given for your final answer in the blanks and the work shown below.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT