user2998413
user2998413

Reputation: 73

largest negative real number represented using IEEE floating point

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 ?

Upvotes: 1

Views: 3151

Answers (1)

user3386109
user3386109

Reputation: 34829

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    

Upvotes: 4

Related Questions