Off-by-one error
An off-by-one error or off-by-one bug (known by acronyms OBOE, OBO, OB1 and OBOB) is a logic error that involves a numerical value incorrectly bigger or smaller by one. It often occurs in computer programming when a loop iterates one time too many or too few. Such problem arises, for instance, when a programmer writes non-strict inequality (≤) in a terminating condition where strict inequality (<) should have been used (or vice versa). Off-by-one errors also stem from confusion over zero-based numbering. An off-by-one error can sometimes appear in a mathematical context.
This article is issued from Wikipedia. The text is licensed under Creative Commons - Attribution - Sharealike. Additional terms may apply for the media files.