Reputation: 73
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
Reputation: 34829
From this wikipedia article the formula for calculating the value from the bit pattern is
The largest negative number will have
Note that an exponent of 255 is reserved for special cases like infinity and NAN.
Plugging those values into the formula, we get
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