# Calculate the largest possible floating-point value: formula?

If I have a 32-bit representation of a floating-point where 1 bit is the sign, 8 bits are the exponent, and 23 bits make up the mantissa. The exponent notation is Excess-127.

32=1+8+23


And, where the "1." of the mantissa is implied and not stored in the binary sequence.

It makes sense to me to calculate the largest, possible, positive floating-point using this formula:

(implicit "1." value) + (largest possible bit sequence) × (largest possible exponent)


... which in this case is:

(1) + ( { 2^(23) - 1 } x {2^128} )


The textbook I'm studying from uses this formula:

+ { 1 - 2^(-24) } x 2^(128)


The only part; in this formula; that makes sense to me, is 2^(128). I don't understand why they are using 2^(-24). I don't understand why they are subtracting 2^(-24) from 1 either.

Is the formula correct? And if so, how does it work? If anyone could point me to resources that explain this I would really be grateful.

• You would also need to specify the format of the exponent. Here it seems to be signed int8, while the IEEE format with the same bit distribution uses an unsigned int8 format that is then shifted by a bias of 127 (the corresponding bias for the double format is accordingly 1023). Feb 24, 2017 at 16:55
• Sorry, I thought with 8 bits for the exponent representation, it was obvious that it the notation was Excess-127. I'm still learning, sorry. Feb 24, 2017 at 17:08
• Then the book is either wrong or reserves the highest exponent for non-numerical values/exceptions, as that formula only works if the highest useful exponent is $127$. Feb 24, 2017 at 18:34
• @Lutzl Please look at this math.stackexchange.com/questions/2158495/excess-notation-sys‌​tem is the answer there correct? If not why not. Please. Feb 24, 2017 at 19:05
• Yes, it is correct. That way the IEEE754 number formats are constructed. But it is not clear, despite the obvious similarities, if the format in your task is the IEEE754 32 bit floating point format. Feb 24, 2017 at 21:31

• No, the book is correct as $(1.1111…1)_2=2-2^{-23}$ and $2^{127}·(2-2^{-23})=2^{128}·(1-2^{-24})$. Note that in the IEEE format, the highest and lowest exponents are reserved for infinity and NAN. Feb 24, 2017 at 16:51