Please help with decimal to floating-point conversion

  • Thread starter Thread starter neshepard
  • Start date Start date
Click For Summary

Discussion Overview

The discussion revolves around converting the decimal number -0.46875 to its binary floating-point representation using the IEEE 754 standard. Participants explore the steps needed to determine the biased exponent and normalized mantissa, addressing challenges and uncertainties in the conversion process.

Discussion Character

  • Homework-related
  • Technical explanation
  • Debate/contested

Main Points Raised

  • One participant identifies the sign bit as 1 due to the negative value but expresses confusion about finding the exponent and normalized mantissa.
  • Another participant asks for clarification on whether the discussion pertains to IEEE 754 single precision.
  • A participant mentions that the professor's examples are in 32-bit format while the current problem involves a fixed point 9-bit example.
  • There is a question about the appropriateness of adding zeros to the binary representation and where they should be added.
  • One participant explains that the biased exponent is used for notation and questions how the bias affects the mantissa's ending zeros.
  • A suggestion is made to convert 0.46875 to binary and rewrite it in normalized scientific notation, followed by steps to derive the necessary components for IEEE format.
  • Concerns are raised about whether the original poster (OP) has clearly communicated their doubts regarding the biased exponent.
  • Another participant clarifies that the OP seems to have calculated the mantissa but struggles with storing it in the 32-bit format.
  • One participant defends their suggestion of a binary converter, stating it can handle fractional binary values and aims to encourage the OP to think critically about the conversion process.

Areas of Agreement / Disagreement

Participants express various viewpoints on the conversion process, with some agreeing on the steps needed while others highlight confusion regarding the handling of the mantissa and biased exponent. The discussion remains unresolved, with multiple competing views on how to approach the problem.

Contextual Notes

There are limitations in the clarity of the OP's problem statement, particularly regarding the steps they have taken and their understanding of how to apply the IEEE 754 format. The discussion also reflects uncertainty about the implications of adding zeros to the binary representation.

neshepard
Messages
67
Reaction score
0

Homework Statement


This is the number given to convert to binary: -0.46875. I need to find the biased exponent and the normalized mantissa in binary.

Homework Equations


The Attempt at a Solution


I am not a computer sci major, but have to take for my electrical engineering degree, and this is harder to me than physics and calc 2. Anyway...
Sign bit is 1 since it's negative, that much I know.

But from here out I'm wrong or lost.
No whole number so no way to find exponent?
.46875 = 01111000 in 8bit
no exponent because no whole number so I just use 127=01111111 in 8bit?
and then...
 
Physics news on Phys.org
I take it you are doing some form of IEEE 754? Single precision, maybe? Please confirm/elaborate.
 
Yes this is IEEE 754, for my intro to computer systems class. I have the steps all written down to solve it, but the numbers the professor gave in his examples are all 32 bit and the example is a fixed point 9 bit (plus a sign bit).
 
Not sure if I understand what the problem is - shouldn't you just fill up with zeros?
 
I managed to solve it. What he gave us is the adjusted mantissa. This meant to find the needed parts I had to both backwards and forwards work the problem.

As to Borek, that is part of the problem, can I just add zeros? Where do I just add them? At the back of the number it doesn't change the decimal but it changes how the whole number is used for the biased exponent. At the front of the number it changes the decimal part of the floating point part.
 
As far as I understand biased exponent is used for notation, for calculations/conversion you can "unbias" it. But then, can be I have a (relatively early) senior moment, but I fail to see how the fact that the exponent is biased changes meaning of ending zeros in mantissa.

.11*22 doesn't differ from .1100*22, biased mantissa means just that the number is multiplied by some power of 2.

Or am I missing something?
 
The first thing to do is convert 0.46875 to binary; you can do it by hand, or use a binary converter (I have one at http://www.exploringbinary.com/binary-converter/" ): 0.01111. Then, rewrite 0.01111 so it's in normalized binary scientific notation: 1.111 x 2-2. From there, using the definition of the IEEE format (single or double), you should be able to get what you need.
 
Last edited by a moderator:
I have a feeling that you posted just to promote your site, as you have not addressed OP doubts - in fact, your answer have ignored them completely.
 
Last edited:
OP seemed to have trouble arriving at the biased exponent. This problem is all about following specific steps which OP has not shared clearly in order to see if there is a misunderstanding or not. What Dr. Binary is saying is correct and is a prerequisite for calculating the correct biased exponent. Web site may be a self-promotion, but honestly, it's kinda neat (the Windows Accessory Calculator can't deal with fraction->binary). Zero fill on the back of the number is fine, but It's not clear what OP is concerned about. Glad to see that OP solved it. What was the OP's final result? The following suggests there still may be some confusion:

I managed to solve it. What he gave us is the adjusted mantissa. This meant to find the needed parts I had to both backwards and forwards work the problem.

As to Borek, that is part of the problem, can I just add zeros? Where do I just add them? At the back of the number it doesn't change the decimal but it changes how the whole number is used for the biased exponent. At the front of the number it changes the decimal part of the floating point part.
 
  • #10
I "promoted" my binary/decimal converter because it's the only one I know of that can handle fractional binary values (to arbitrary precision). I could have pointed the OP to one of those converters that convert directly to IEEE format, but I thought that would have been "cheating." I thought making the OP think about binary scientific notation -- which by the way, I have an article about, but which I DIDN'T promote :) -- would help him reason through the question.

Maybe the OP can tell me if I helped or not? If not, I'd be happy to try again.
 
  • #11
From what I understand OP didn't have a problem with finding mantissa (see the very first post, where mantissa is already calculated), but with storing it in the 32 bit format (as mantissa is much shorter than its field, 4 bits vs 23 bits).
 

Similar threads

  • · Replies 17 ·
Replies
17
Views
3K
  • · Replies 4 ·
Replies
4
Views
2K
Replies
4
Views
2K
Replies
9
Views
2K
  • · Replies 6 ·
Replies
6
Views
2K
  • · Replies 6 ·
Replies
6
Views
4K
Replies
2
Views
2K
Replies
10
Views
4K
  • · Replies 14 ·
Replies
14
Views
3K
  • · Replies 7 ·
Replies
7
Views
4K