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

I think the poster meant off-by-one doesn’t simply mean a plus or minus one error, like mispricing a $5.99 as $6.99, but instead must be born out of confusion as to whether an origin point is marked as a 1 or as a 0.


Off-by-one is not born from the base of the index. It is a general problem a lot of people run into in a lot of different contexts.

It’s for example called “the fencepost problem”: https://betterexplained.com/articles/learning-how-to-count-a...

I agree subtracting or adding one to any number is not the problem. It has to do with counting.


>I agree subtracting or adding one to any number is not the problem. It has to do with counting.

if you are sprint climbing and you put your hand out to grab and you add or subtract the number 1 from where your hand needs to be, it is a problem or contributes to a speed difference.


> must be born

There are other reasons as well. I think the more common causes are inclusive vs exclusive comparison errors and fencepost.


> must be born

The spelling is off by one. It's "borne"


>The spelling is off by one. It's [not "born" it's] "borne"

the spelling was actually off by e , so you're stilll off by 1.71828...


Perhaps the pieces are placed by counting a number of holes from piece A to piece B? That's a perfect recipe for an off-by-one: at which point relative to piece A do you start counting.




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

Search: