1
votes

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 ?

1
Not clear what you are asking. What is "answer form"? - DrKoch
What are you expecting? A code? or the correct answer? or an algorithm? - Arun A S
"... and mantissa is 11111111, and the exponent is 255. ..." is not correct. and -1.11111111(base2) x 2^128 --> -6.792355...e+38 - chux - Reinstate Monica
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. - mfro
255 exponent is used for infinity and NaN. - gnasher729

1 Answers

4
votes

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