Sign in to follow this  
Halifax2

IEEE 754-2008 (binary 16) inaccuracy in Wikipedia?

Recommended Posts

To open, I'm using Wikipedia because I can't find any document online for the IEEE 754-2008 standard like a specification for OpenGL, so Wikipedia is my next best option. I'm currently implementing the binary16 portion of the standard on a simple embedded processor that only supports integer manipulation in hardware. Now I am assuming the following as fact that binary16 numbers have 3 digits of precision after the decimal point: floor(log(2^11)) = 3; a starting digit of 1 before the decimal point (1.) is assumed with the coefficient/significand representing the fractional part, when the exponent is neither 0 or 16 (biased); and the maximum exponent is 15 (biased). I arrive at the following value being the maximum that a binary16 representation can hold: 1.999 * 2^15 = 65503.232, and the binary representation of that would be: 0 11110 1111100111 (separated into S EEEEE CCCCCCCCCCC) where S = 0 (positive), E = 30 (unbiased) 15 (biased), C = 999. That translates into the following hexadecimal representation: 0x7BE7 On Wikipedia they are reporting 65504 as the maximum value. (My number, 65503.232, doesn't even round to that.) And they say the hexadecimal representation is 0x7BFF: 0 11110 1111111111. Notice that our sign and exponent are the same, the only thing they are changing is the coefficient which is equal to 1023 in base 10. This doesn't make sense to me. Maybe I am missing something, or maybe I am right. Can someone explain why they are wrong or why they are right? This is only only thing that is holding me up in my analysis.

Share this post


Link to post
Share on other sites
If it's anything like normal 32 bit floats (which I'm sure it is), then the fraction isn't encoding a decimal (base 10) value, they're encoding the negative powers of 2.

1.1000000000 = 1.5, not 1.512 (frac = 2^-1)
1.0100000000 = 1.25, not 1.256 (frac = 2^-2)
1.1100000000 = 1.75, not 1.768 (frac = 2^-1 + 2^-2)

Share this post


Link to post
Share on other sites
Quote:
Original post by Namethatnobodyelsetook
If it's anything like normal 32 bit floats (which I'm sure it is), then the fraction isn't encoding a decimal (base 10) value, they're encoding the negative powers of 2.

1.1000000000 = 1.5, not 1.512 (frac = 2^-1)
1.0100000000 = 1.25, not 1.256 (frac = 2^-2)
1.1100000000 = 1.75, not 1.768 (frac = 2^-1 + 2^-2)



Exactly

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this