Why is it that the IEEE 754 standard provide 8 bits for the exponent but puts a range maximum of 38 on the largest acceptable exponent?

Seems kind of ridiculous to have the data storage there but not allow it to actually be used.

I wanted to pack data into this exponent for some encoding I'm doing, but I can't use all the bits because I can't pack an exponent larger than 38! I was hoping to pack values up to 256 using all bits (2 ^ 8).


2 Answers 2


Floating point stores the exponent and mantissa in base two, not base 10. Two to the 127th power corresponds roughly to ten to the 38th power, so that's the largest decimal number that can be stored.

See https://www.google.com/#q=2+to+the+127th+power

  • 1
    I started to realize this was where I went wrong after the other poster responded, but you really helped clear it up succinctly. Thanks for realizing my error. :)
    – JamesHoux
    Dec 24, 2013 at 6:05

IEEE 754 standard single-precision (i.e., 32-bit) floats reserve 1 bit for the sign bit, 8 for the exponent, and 23 for the mantissa. I'm not sure where you're getting a value of 38 (base 10) from as the "maximum" exponent. Please clarify in the comments if I'm interpreting this incorrectly.

Since the exponent is 8 bits, the range of exponent values can be anywhere between 00000000 and 11111111 (which are reserved for 0 and infinity, respectively). However, any exponent value between 00000001 and 11111110 is valid. So, accounting for a bias of -127, you can achieve an exponent of 127.

So, assuming a mantissa of all 1's (i.e., a value very close to 2), you can achieve up to 2^127 for your encoding.

If all you need is 2^8 for your encoding, consider using overall fewer bits in your floating point number.

Read more here: http://steve.hollasch.net/cgindex/coding/ieeefloat.html

  • 1
    Ah, now I see his confusion. If he wants 256 as the exponent in the corresponding decimal number, then he needs to use a double-precision floating point number, which can yield a maximum exponent of 308 (base 10). Though I'm not sure this is what he's trying to ask...
    – bunting
    Dec 24, 2013 at 5:48

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.