Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

The reason exponents have so many bits is basically to solve this problem. The exponent/mantissa bits of IEEE 754 double could have been 8 and 55, but I suppose the standard committee decided that some precision should be sacrificed to allow stupid values outside the range of meaningful physical numbers so that you never have to worry about the problem mentioned in this article. So if you pretend that doubles have 8 exponent bits as they probably should have been, then `sum(list) / len(list)` will always work for this set of "sane" values.

And if that isn't enough, you have subnormal numbers as a safety net as well, although using these kills performance on many FPUs.



Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: