1

So I want to find the largest negative real number that can be represented using the IEEE-754 floating point.

So far I know the sign bit should be 1, and mantissa is 11111111, and the exponent is 255. I just put them into the formula, then I get -1.11111111 x 2^128.

The answer is -3.403 x 10^38.

How do I transform what I have into the answer form ?

5
  • 2
    Not clear what you are asking. What is "answer form"? Commented Apr 18, 2015 at 6:33
  • What are you expecting? A code? or the correct answer? or an algorithm? Commented Apr 18, 2015 at 6:38
  • "... and mantissa is 11111111, and the exponent is 255. ..." is not correct. and -1.11111111(base2) x 2^128 --> -6.792355...e+38 Commented Apr 18, 2015 at 6:40
  • just do your math. Multiplicate what you found - if you can't do in memory, use your calculator and type -1.11111111 x 2^128. Which will give you a different number than you are expected. Commented Apr 18, 2015 at 6:44
  • 1
    255 exponent is used for infinity and NaN. Commented Apr 18, 2015 at 7:06

1 Answer 1

4

From this wikipedia article the formula for calculating the value from the bit pattern is

enter image description here

The largest negative number will have

  • sign bit = 1
  • mantissa = all 1's
  • exponent = 254

Note that an exponent of 255 is reserved for special cases like infinity and NAN.

Plugging those values into the formula, we get

enter image description here

which can be written as

value = (-1)(1 + 0.5 + 0.25 + 0.125 + ... + 2^-23)(2^127)
      = (-1)(2)(2^127)  // since the sum is approximately 2
      = -(2^128)    
      = -3.403 x 10^38  // says my calculator    
Sign up to request clarification or add additional context in comments.

4 Comments

@user2998413: It looks pretty good to me. What do you think is wrong with it?
@user2998413 Aside from maybe considering "largest negative real number" as -INF, this answer does well describe finding the largest finite negative bianry32. "IEEE-754 floating point" does have other floating point types with finite values about -10*pow(10,6144). Other than that, your comment needs explanation.
@user2998413 It's hard to improve the answer unless you tell me why you think it's wrong.
Are any of them reserved? Usually it's first and last

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.