bartaz/ieee754-visualization

Invalid exponent in sum?

apaszke opened this issue · 2 comments

The sum on the page is displayed as:
IEEE 754 sum

However, when you set the 52'nd bit to 1 you should add 2^(-1) not 2^(-0), so there is probably a -1 missing in the exponent. Am i right?

Yes, it's true. Very well spotted.
The change would actually be not really in the exponent but in the sum. I guess that making the sum from i=1 to 52 would fix that. And it's exactly like that on wiki: https://en.wikipedia.org/wiki/Double-precision_floating-point_format

I don't remember why I made the sum from i=0 to 51. It doesn't look like a typo, so there must have been some thought behind it, but now I don't know what was it ;)

It depends on how you're counting the bit numbers. If you start from 0 then changing the bottom index from 0 to 1 is fine :)

Anyway, it's a great demo! It's been really helpful! Thanks! 👍