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

This type of off-by-one error is so common it has its own name: fencepost error[1].

One little note, is that I would disagree with your correction.

> This should be corrected to:

> > The number of values between the two is 0x3f800000 - 0x00000000 == 0x3f800001

I think the value originally computed was correct. It would make more sense to correct the wording rather than just the computed value.

i.e.

> The number of values in the range [0x00000000, 0x3f800000] is 0x3f800000 - 0x00000000 + 1 == 0x3f800001

[1]: https://en.wikipedia.org/wiki/Off-by-one_error#Fencepost_err...



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

Search: