[WEBINAR] Better to Ask Permission? Best Practices for Privacy and Security

Fencepost Error

Definition - What does Fencepost Error mean?

A fencepost error is a specific type of off-by-one error that has to do with unlikely or misunderstood algorithms for development.

Fencepost errors are also known as telegraph pole errors and lamppost errors.

Techopedia explains Fencepost Error

At the heart of the fencepost error is the idea that the number of posts used for a fence project differs based on whether the fence is long with two opposite ends, or whether it circles back to a closed loop. In the former scenario, a fencepost error can occur if a person makes an intuitive supposition that a fence only needs as many posts as dividing the length by the length between posts. For example, if the fence is 50 feet long and has posts every 5 feet, the human working on this problem might suppose that the fence needs 10 posts. However, if the fence is not a closed loop, it needs an additional post at the end — in other words, it needs a post at the starting point or zero, as well as a post at the ending point or end number. Algorithms demonstrating the fencepost principle would use a phrase like “n+1” posts. However, it must be noted that if the fence is a closed loop, the additional fencepost is not needed.

The fencepost error has multiple allegories and applications to coding and development. It represents one of many logical errors that cause programs to experience bugs or produce inaccurate results.

Share this:

Connect with us

Email Newsletter

Join thousands of others with our weekly newsletter

The 4th Era of IT Infrastructure: Superconverged Systems
The 4th Era of IT Infrastructure: Superconverged Systems:
Learn the benefits and limitations of the 3 generations of IT infrastructure – siloed, converged and hyperconverged – and discover how the 4th...
Approaches and Benefits of Network Virtualization
Approaches and Benefits of Network Virtualization:
Businesses today aspire to achieve a software-defined datacenter (SDDC) to enhance business agility and reduce operational complexity. However, the...
Free E-Book: Public Cloud Guide
Free E-Book: Public Cloud Guide:
This white paper is for leaders of Operations, Engineering, or Infrastructure teams who are creating or executing an IT roadmap.
Free Tool: Virtual Health Monitor
Free Tool: Virtual Health Monitor:
Virtual Health Monitor is a free virtualization monitoring and reporting tool for VMware, Hyper-V, RHEV, and XenServer environments.
Free 30 Day Trial – Turbonomic
Free 30 Day Trial – Turbonomic:
Turbonomic delivers an autonomic platform where virtual and cloud environments self-manage in real-time to assure application performance.