Solved

# convert the binary ot  floating point format

Posted on 2011-10-15
Medium Priority
1,026 Views
1 Endorsement
Convert the following binary and hexadecimal numbers to floating point format point. Assume a binary format consisting of a sign bit (negative =1), a base 2, 8 bit, excess-128 exponent, and 23 bits of mantissa, with the implied binary point the right of the first bit of mantissa.

a. 110110.011011

Can anyone give me an example on how to work this problem.

1
Question by:waltbaby315
• 7
• 6

LVL 37

Expert Comment

ID: 36974766
Well, if you wanted to convert the number 345234.3234 to a similar format it would be
.3452343234 * 10^6
So the mantissa is 3452343234 the exponent is 6 and the sign bit is 0. The problem you have is the exact same except in binary.

Since this is clearly academic in nature, I will attempt to guide you to the solution instead of just giving a complete answer (and all the other experts here would do the same).
0

Author Comment

ID: 36974814

This is what I got for this step.
110110011011 is the mantissa, the exponent is 6 the sign bit is 0. and it is written like this:

0.110110011011, exponent 6 the sign bit is 0.
0

LVL 37

Expert Comment

ID: 36974820
Close. Except the answer should be written in a full 32 bit binary number. You can't write a 6 for the exponent, remember it's all in binary and the order is important.
So you need to take your answer and turn it into a single sign bit followed by 8 bits of exponent and 23 of mantissa (remember to pad with 0s on the correct sides). Let me know what you come up with.
0

Author Comment

ID: 36974846
This is what I have.

sign       exponent             mantissa
0.       00000110         1101100110110000000000
0

LVL 37

Expert Comment

ID: 36974858
Excellent. It's almost perfect, just missing two things.
1. I only count 22 bits in your mantissa, but that's an easy fix.
2. The exponent should be in excess 128 notation
http://www.pdcfaculty.org/rtureman/IntroCourses/CSC200/Projects/c200_ch01_excess_notation.htm
So you need that first bit to be a 1.

For the final answer, I assume you are expected to actually put them all together in one big 32 bit float, but noting which part is which is a good idea.
0

LVL 37

Expert Comment

ID: 36974863
Oh, and since it says "with the implied binary point the right of the first bit of mantissa" I think the exponent should actually be 5, not 6 since it would convert to 1.10110011011. That's my fault. I was assuming C-style floats.
0

Author Comment

ID: 36974871
for the exponent excess  128 notation, Should i add or subtract 128-6= 122, then put 122 in binary. I did this because I moved the decimal point 6 places. to the right.
0

LVL 37

Expert Comment

ID: 36974875
No. Excess 128 notation is almost identical to normal signed notation except the first bit is 1 for positive. So your last answer was fine for 6 except the first digit should be a 1. Also, since the assignment says that the point is to the right of the first bit of the mantissa, then you only move the point 5 places, not 6. That was my fault for missing that part the first time I read it.
0

Author Comment

ID: 36974891
So it should go like this:

sign       exponent             mantissa
0.       10000110         1101100110110000000000
0

LVL 37

Expert Comment

ID: 36974902
Well, there's still only 22 bits in your mantissa, and the way I interpret the problem, the exponent is 5, not 6, but other than that, it's perfect.
0

Author Comment

ID: 36974907
I think i got it now.

sign       exponent             mantissa
0.       10000101         11011001101100000000000
0

LVL 37

Accepted Solution

TommySzalapski earned 2000 total points
ID: 36974913
Yes. Given the instructions, that should be the exact correct answer.
0

Author Comment

ID: 36974914
Thanks,
0

## Featured Post

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Iteration: Iteration is repetition of a process. A student who goes to school repeats the process of going to school everyday until graduation. We go to grocery store at least once or twice a month to buy products. We repeat this process every montâ€¦
Looking for a way to avoid searching through large data sets for data that doesn't exist? A Bloom Filter might be what you need. This data structure is a probabilistic filter that allows you to avoid unnecessary searches when you know the data definâ€¦
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201â€¦
Is your data getting by on basic protection measures? In todayâ€™s climate of debilitating malware and ransomwareâ€”like WannaCryâ€”that may not be enough. You need to establish more than basics, like a recovery plan that protects both data and endpoints.â€¦
###### Suggested Courses
Course of the Month17 days, 6 hours left to enroll