Converting 2000.90210 to IEEE 754 Hexadecimal

In summary, the conversation discussed converting the decimal number 2000.90210 to a single-precision IEEE 754 hexadecimal. The equations and steps for converting the number were also discussed, including the exponent field and the fraction field bits. A potential issue with the Java applet software was raised, but it was determined to be a mistake in the exponent calculation. The problem was resolved with the help of other members in the conversation.
  • #1
s3a
818
8

Homework Statement


Convert the decimal number 2000.90210 to a single-precision IEEE 754 hexadecimal.

Homework Equations


(exponent field)_10 - 127_10 = exponent_10
The first bit is the sign bit.
The 2nd to 9th bits are the exponent bits.
The 10th to 32nd bits are the fraction field bits.
1.(fraction field)_2 x 2^(exponent_10) leads to the base 10 final answer

The Attempt at a Solution


My attempt at the solution is attached as MyWork.jpg.

I was planning to convert it to the binary IEEE 754 32-bit single-precision representation since that's what I am familiar with and then convert it to hexadecimal however, it seems that when I do this, my binary version is far off from the decimal value I'm initially given.

I'm not sure but, this might be related to the fact that the binary fraction field is (at least, seemingly) irrational.

Any help in solving this problem would be greatly appreciated!
 

Attachments

  • MyWork.jpg
    MyWork.jpg
    29.1 KB · Views: 1,958
Physics news on Phys.org
  • #2


s3a said:
I'm not sure but, this might be related to the fact that the binary fraction field is (at least, seemingly) irrational.
Rational <-> irrational is independent of the base you express a number in. There is no exact representation of the number with a finite number in base 2, but that does not matter. It just gives a small rounding error.

my binary version is far off from the decimal value I'm initially given.
In which way?
Your attempt looks fine.
 
  • #3


Hello.

Rational <-> irrational is independent of the base you express a number in. There is no exact representation of the number with a finite number in base 2, but that does not matter. It just gives a small rounding error.
Alright.

In which way?
Your attempt looks fine.
When I input my binary IEEE 754 answer to this ( http://www.h-schmidt.net/FloatConverter/IEEE754.html ) website, the decimal representation is around 4001.80. If it's not my work that's wrong, what's wrong with the Java applet software or with the way I am “communicating” with it?
 
  • #4


s3a said:
(exponent field)_10 - 127_10 = exponent_10
so this means
(exponent field)_10 = exponent_10 + 127_10

if exponent_10 is 127, then what should (exponent field)_10 be?
 
  • #5


so this means
(exponent field)_10 = exponent_10 + 127_10

if exponent_10 is 127, then what should (exponent field)_10 be?
The equation is (exponent field)_10 = exponent_10 – 127_10. (Notice the – instead of a +.) I did do that in my work, however. So, why is the Java applet software disagreeing strongly with me?
 
  • #6


From your first post:

s3a said:
(exponent field)_10 - 127_10 = exponent_10

start with the equation from your first post:

(exponent field)_10 - 127_10 = exponent_10

then add 127_10 to both sides:

(exponent field)_10 = exponent_10 + 127_10
 
  • #7


s3a said:
When I input my binary IEEE 754 answer to this ( http://www.h-schmidt.net/FloatConverter/IEEE754.html ) website, the decimal representation is around 4001.80. If it's not my work that's wrong, what's wrong with the Java applet software or with the way I am “communicating” with it?
I would not call this "far off", it is exactly a factor of 2, indicating a problem with the exponent. rcgldr found the error.
 
  • #8


Good point, mfb. I just noticed that.

And, rcgldr, that was just what I needed to fix my entire answer to the problem.

Thank you both!
 
  • #9


Good point, mfb. I just noticed that.

And, rcgldr, that was just what I needed to fix my entire answer to the problem.

Thank you both!
 

Related to Converting 2000.90210 to IEEE 754 Hexadecimal

1. How do you convert 2000.90210 to IEEE 754 Hexadecimal?

To convert a decimal number to IEEE 754 Hexadecimal, you must first break down the number into its binary representation. This number would be 11111010000.111001. Then, you must determine the bias, which is calculated by adding the number of bits in the exponent (11 bits in this case) to 127. The bias would be 138. After that, you must convert the binary number to scientific notation, which would be 1.1111010000111001 x 2^11. Finally, you must arrange the bits according to the IEEE 754 Hexadecimal format, and the resulting value would be 4F80E7C0.

2. What is the significance of converting a decimal number to IEEE 754 Hexadecimal?

Converting a decimal number to IEEE 754 Hexadecimal is important in computer science and engineering because it allows for a standardized way of representing and performing calculations with floating-point numbers. This format is used in various programming languages and systems, making it crucial for accurate and efficient computations.

3. Can any decimal number be converted to IEEE 754 Hexadecimal?

Yes, any decimal number can be converted to IEEE 754 Hexadecimal. However, some numbers may result in infinite or repeating binary representations, which may require rounding or approximations to fit into the 32-bit or 64-bit format of IEEE 754 Hexadecimal.

4. Is converting to IEEE 754 Hexadecimal reversible?

Yes, converting a decimal number to IEEE 754 Hexadecimal can be reversed by following the same steps in reverse order. This means converting the hexadecimal number back to its binary representation, converting it to decimal, and then adjusting for the bias and decimal point to get the original number.

5. Are there any alternatives to converting numbers to IEEE 754 Hexadecimal?

Yes, there are other formats for representing floating-point numbers, such as binary-coded decimal (BCD) and fixed-point representation. However, IEEE 754 Hexadecimal is the most widely used and standardized format for floating-point numbers in computer science and engineering.

Similar threads

  • Engineering and Comp Sci Homework Help
Replies
1
Views
1K
Replies
6
Views
9K
  • Engineering and Comp Sci Homework Help
Replies
16
Views
2K
Replies
4
Views
1K
  • Engineering and Comp Sci Homework Help
Replies
10
Views
3K
  • Programming and Computer Science
Replies
6
Views
1K
  • Programming and Computer Science
Replies
23
Views
4K
  • Precalculus Mathematics Homework Help
Replies
2
Views
2K
  • Engineering and Comp Sci Homework Help
Replies
1
Views
2K
  • Engineering and Comp Sci Homework Help
Replies
14
Views
3K
Back
Top