FENCEPOST ERROR
\fˈɛnsɪpˌə͡ʊst ˈɛɹə], \fˈɛnsɪpˌəʊst ˈɛɹə], \f_ˈɛ_n_s_ɪ_p_ˌəʊ_s_t ˈɛ_ɹ_ə]\
Sort: Oldest first
-
1. (Rarely "lamp-post error") A problem with the discreteequivalent of a boundary condition, often exhibited inprograms by iterative loops. From the following problem: "Ifyou build a fence 100 feet long with posts 10 feet apart, howmany posts do you need?" (Either 9 or 11 is a better answerthan the obvious 10).For example, suppose you have a long list or array of items,and want to process items m through n; how many items arethere? The obvious answer is n - m, but that is off by one;the right answer is n - m + 1. The "obvious" formula exhibitsa fencepost error.See also zeroth and note that not all off-by-one errorsare fencepost errors. The game of Musical Chairs involves acatastrophic off-by-one error where N people try to sit in N -1 chairs, but it's not a fencepost error. Fencepost errorscome from counting things rather than the spaces between them,or vice versa, or by neglecting to consider whether one shouldcount one or both ends of a row.2. (Rare) An error induced by unexpected regularities in inputvalues, which can (for instance) completely thwart atheoretically efficient binary tree or hash codingimplementation. The error here involves the differencebetween expected and worst case behaviours of an algorithm.
By Denis Howe
Word of the day
Dopamine Acetyltransferase
- An enzyme that catalyzes the of groups from acetyl-CoA to arylamines. They have wide specificity for aromatic amines, particularly serotonin, and can also catalyze acetyl transfer between arylamines without CoA. EC 2.3.1.5.